SY-3242: Completed String Support in Arc #1801
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Pull Request
Linear Issue
SY-####
Description
Basic Readiness
Greptile Summary
Implemented comprehensive string support in Arc, including literals, concatenation, and equality operations across the Go compiler and C++ runtime.
Key Changes:
strconv.Unquotestring_concat,string_equal,string_len,string_create,string_get+) and equality (==,!=) operators in Arc expressionsIssues Found:
arc/go/compiler/wasm/module.go:171- incorrect package referencebinary.binary.WriteLEB128Unsignedwill cause compilation failureTest Coverage:
Confidence Score: 1/5
binary.binary.WriteLEB128Unsignedin module.go:171 will cause immediate compilation failure. While the implementation is otherwise solid with good test coverage, this blocking issue prevents the PR from being functionalarc/go/compiler/wasm/module.gorequires immediate fix before mergeImportant Files Changed
binary.binary.)+) and equality (==,!=) operatorsParseStringfunction usingstrconv.Unquotefor proper escape handlingSequence Diagram
sequenceDiagram participant User as Arc Source Code participant Parser as Arc Parser participant Compiler as Expression Compiler participant Module as WASM Module participant Runtime as C++ Runtime User->>Parser: Parse string literal "hello" Parser->>Compiler: STR_LITERAL token Compiler->>Compiler: ParseString() - unescape & validate Compiler->>Module: AddData(bytes) - add to data section Module-->>Compiler: Return offset in memory Compiler->>Module: Emit i32.const offset Compiler->>Module: Emit i32.const length Compiler->>Module: Emit call $string_from_literal Note over User,Runtime: String Concatenation ("a" + "b") User->>Compiler: Binary + expression Compiler->>Module: Compile left operand (handle1) Compiler->>Module: Compile right operand (handle2) Compiler->>Module: Emit call $string_concat Module->>Runtime: string_concat(h1, h2) Runtime->>Runtime: Find strings, concat, create new handle Runtime-->>Module: Return new handle Note over User,Runtime: String Equality ("a" == "b") User->>Compiler: Binary == expression Compiler->>Module: Compile operands Compiler->>Module: Emit call $string_equal Module->>Runtime: string_equal(h1, h2) Runtime->>Runtime: Compare strings Runtime-->>Module: Return 1 or 0