Skip to content

Commit 33be329

Browse files
minokiclaude
andcommitted
Add WasmSyntax IR and WAT text format writer
Add WasmGC backend infrastructure: - src/wasm/syntax.sml: WasmSyntax module defining the Wasm binary AST including value types, heap types, GC instructions (struct/array/i31), reference instructions, exception handling (try_table), and module structure (types, funcs, imports, exports, data, elem, etc.) - src/wasm/wat-writer.sml: WAT text format writer for debugging, outputting S-expression format with proper indentation and escaping - Update Makefile and lunarml-common.mlb to include new sources - Update .gitignore for test/wasm build artifacts - Add test/wasm/ with factorial/fibonacci test (fact-fib.sml, Makefile, test-fact-fib.mjs) for future Wasm backend validation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c369b71 commit 33be329

File tree

9 files changed

+1496
-0
lines changed

9 files changed

+1496
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ test/*/*/*.lua
88
test/*/*.mjs
99
test/*/*/*.mjs
1010
test/**/*.output
11+
test/wasm/fact-fib
12+
test/wasm/fact-fib.wasm
13+
test/wasm/fact-fib.wat
1114
bin/lunarml
1215
bin/lunarml.debug
1316
thirdparty/smlnj-lib/

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ sources = \
7070
src/cps/boxing.sml \
7171
src/backend.sml \
7272
src/nested.sml \
73+
src/wasm/syntax.sml \
74+
src/wasm/wat-writer.sml \
7375
src/lua/syntax.sml \
7476
src/lua/transform.sml \
7577
src/codegen-lua.sml \

src/lunarml-common.mlb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ backend.sml
6060
nested.sml
6161
lua/transform.sml
6262
codegen-lua.sml
63+
wasm/syntax.sml
64+
wasm/wat-writer.sml
6365
js/syntax.sml
6466
js/transform.sml
6567
js/simplify-jumps.sml

0 commit comments

Comments
 (0)