A compiler for Language I: lexing and parsing (JavaCC), semantic analysis, and code generation to WebAssembly text format (WAT). The CLI can compile sources, dump an AST, or compile and execute via wasmtime.
| Requirement | Purpose |
|---|---|
| JDK 15+ | Compile and run the project |
| Apache Maven 3.x | Build, tests, JavaCC code generation |
wasmtime on PATH |
run subcommand and WebAssembly integration tests |
From the repository root:
./scripts/build.shThis runs mvn clean package -DskipTests and produces:
target/compiler-i-1.0.0.jar
Alternatively:
mvn clean packagejava -jar target/compiler-i-1.0.0.jar <command> <source.i> [options]
| Command | Description |
|---|---|
compile |
Emit WAT for the source file (-o output path). |
run |
Compile to WAT and execute with wasmtime. |
ast |
Parse and print the abstract syntax tree. |
Examples:
java -jar target/compiler-i-1.0.0.jar compile tests/integration/array_sum.i -o output/array_sum.wat
java -jar target/compiler-i-1.0.0.jar run tests/integration/array_sum.i -o output/array_sum.wat
java -jar target/compiler-i-1.0.0.jar ast tests/integration/array_sum.iUnit tests (JUnit 5):
mvn testWebAssembly integration tests (compile .i fixtures to WAT and run under wasmtime; requires a prior build):
./run_integration_wasm.shgrammar/— JavaCC grammar (LanguageI.jj)src/main/java/— lexer, parser adapter, AST, semantic passes, codegen, CLI entrypointtests/integration/— Language I programs used by integration scripts
This project is released under the MIT License.