Skip to content

SYX Compiler — Complete Technical Documentation (Rust Implementation) ​

简体中文

Table of contents ​

  1. Project overview
  2. Cargo workspace and layout
  3. Architecture and compilation pipelines
  4. Crate responsibilities
  5. Compilation driver (syx-driver)
  6. Command-line tool (syx-cli)
  7. Module system and dependencies
  8. Incremental compilation cache
  9. Meta and async compile-time passes
  10. Frontend: lexing, parsing, semantics
  11. Code generation and intermediate representation
  12. Virtual machine and runtime
  13. Standard library and host functions
  14. Toolchain crates (P2/P3)
  15. Error handling and diagnostics
  16. Testing
  17. Build and CI
  18. Appendix

1. Project overview ​

1.1 Introduction ​

SYX is a programming language inspired by Swift syntax. The compiler and toolchain are implemented entirely in Rust, organized as a Cargo workspace, covering the full path from source to executable bytecode.

Core pipeline:

StageCrateRole
Lexical analysissyx-lexerSource → token stream
Parsingsyx-parserTokens → AST (syx-ast)
Semantic analysissyx-semanticType checking, symbol tables, module imports
Meta passessyx-metaData class registration, pure/IO effect checks
Async checkssyx-asyncasync/await syntax constraints
Code generationsyx-codegenAST or MIR → VM instructions
Executionsyx-vmStack VM + host functions
Driver orchestrationsyx-driverModule graph, cache, multi-backend entry
User entrysyx-clisyx CLI

1.2 Implementation phases ​

PhaseScopeRust status
P0Modules, strings, file I/O, HTTP, arrays/iterationLargely done; integration tests
P1Null safety, data classes, guard let, effect annotationsPartially done
P2MIR, formatting, lint, doc generation, debug sessionsScaffolding + MVP
P3LLVM native, WASM emit, JIT, metaprogrammingScaffolding + MVP

2. Cargo workspace and layout ​

2.1 Workspace configuration ​

The root Cargo.toml defines the workspace:

  • members: crates/* (19 crates)
  • edition: 2021
  • rust-version: 1.80
  • Shared dependencies: miette, thiserror, clap, serde, toml, bincode, wasm-encoder, reqwest, etc.

2.2 Directory tree ​

synswx/
├── Cargo.toml                    # Workspace root
├── rustfmt.toml                  # Rust formatting rules
├── .github/workflows/ci.yml      # CI: fmt / clippy / test
├── crates/
│   ├── syx-cli/                  # CLI entry (`syx` command)
│   ├── syx-driver/             # Driver, module graph, cache, backends
│   ├── syx-diagnostics/        # Diagnostics, Span, SourceFile
│   ├── syx-lexer/                # Lexer
│   ├── syx-ast/                  # AST definitions and visitor traits
│   ├── syx-parser/               # Recursive-descent parser
│   ├── syx-semantic/             # Semantic analysis and type checking
│   ├── syx-codegen/              # VM bytecode generation
│   ├── syx-vm/                   # Stack VM, GC, hosts, JIT stubs
│   ├── syx-stdlib/               # Builtin types and method registry
│   ├── syx-mir/                  # MIR lowering and optimization
│   ├── syx-async/                # async/await compile-time checks and runtime stubs
│   ├── syx-meta/                 # Data classes, effects, reflection metadata
│   ├── syx-fmt/                  # Source formatter
│   ├── syx-lint/                 # Static lint rules
│   ├── syx-doc/                  # Markdown API doc generation
│   ├── syx-debug/                # Debug sessions and DAP stubs
│   ├── syx-mir-run/              # Shared MIR interpreter (WASM + native FFI)
│   ├── syx-runtime-core/         # Value, protocols, Hasher (no codegen)
│   ├── syx-cranelift/            # MIR → native object (JIT/experimental paths)
│   ├── syx-rt/                   # Native C ABI runtime, linking helpers
│   ├── syx-llvm/                 # LLVM IR emission (native AOT)
│   └── syx-wasm-emit/            # MIR → WebAssembly binary
├── examples/                     # Sample .sy programs and syx.toml
│   ├── hello.sy
│   ├── p0_demo.sy
│   ├── main.sy
│   ├── math.sy
│   ├── module_main.sy
│   └── syx.toml
├── docs/                         # Language and compiler documentation
└── README.md

2.3 Crate dependency graph (simplified) ​

syx-diagnostics
    ↑
syx-lexer → syx-ast → syx-parser
                ↑           ↑
                └── syx-semantic ← syx-stdlib
                        ↑
                   syx-codegen ← syx-mir
                        ↑
                     syx-vm
                        ↑
              syx-async / syx-meta
                        ↑
                   syx-driver ← syx-fmt / syx-lint / syx-doc / syx-debug
                        ↑              syx-llvm / syx-wasm-emit
                     syx-cli

3. Architecture and compilation pipelines ​

3.1 Overall architecture ​

┌──────────────────────────────────────────────────────────────────┐
│                     Source (.sy)                                 │
└────────────────────────────┬─────────────────────────────────────┘
                             │
                             ▼
┌──────────────────────────────────────────────────────────────────┐
│  syx-lexer          Lexical scan → token sequence                │
└────────────────────────────┬─────────────────────────────────────┘
                             │
                             ▼
┌──────────────────────────────────────────────────────────────────┐
│  syx-parser         Recursive descent → syx-ast::Module          │
└────────────────────────────┬─────────────────────────────────────┘
                             │
              ┌──────────────┼──────────────┐
              ▼              ▼              ▼
┌─────────────────┐ ┌──────────────┐ ┌─────────────────┐
│ syx-meta        │ │ syx-async    │ │ syx-macro       │
│ data class /    │ │ async rules  │ │ expand_module   │
│ effect checks   │ │              │ │                 │
└────────┬────────┘ └──────┬───────┘ └────────┬────────┘
         └─────────────────┼──────────────────┘
                           ▼
┌──────────────────────────────────────────────────────────────────┐
│  syx-semantic       Type check + symbols + import merge          │
└────────────────────────────┬─────────────────────────────────────┘
                             │
              ┌──────────────┴──────────────┐
              ▼                             ▼
   ┌─────────────────────┐       ┌─────────────────────┐
   │ Default (VM) path   │       │ SYX_USE_MIR=1       │
   │ AST → syx-codegen   │       │ AST → syx-mir       │
   │                     │       │   → optimize      │
   │                     │       │   → syx-codegen   │
   └──────────┬──────────┘       └──────────┬──────────┘
              │                             │
              └──────────────┬──────────────┘
                             ▼
┌──────────────────────────────────────────────────────────────────┐
│  CompiledProgram (function table + instruction stream)           │
└────────────────────────────┬─────────────────────────────────────┘
                             │
         ┌───────────────────┼───────────────────┐
         ▼                   ▼                   ▼
┌──────────────┐   ┌─────────────────┐   ┌─────────────────┐
│ syx-vm       │   │ syx-llvm        │   │ syx-wasm-emit   │
│ interpret    │   │ MIR → native    │   │ MIR → .wasm     │
│ (default)    │   │ + syx-rt link   │   │                 │
└──────────────┘   └─────────────────┘   └─────────────────┘
         │                   │                   │
         │           syx-mir-run (shared MIR interpreter)
         │           syx-runtime-core (Value / protocols)
         └───────────────────┴───────────────────┘

3.2 Main compilation pipelines ​

The default user path uses MIR as the shared middle end; syx run lowers to VM bytecode; --native / --wasm start from the same MIR graph.

3.2.1 Default pipeline (syx run → VM) ​

Triggers: syx run, syx check (and most day-to-day development)

Source → Lexer → Parser → Macro / Meta / Async Pass → Semantic
       → syx_mir::lower_module → optimize
       → CodeGenerator (MIR → bytecode)
       → VmInstance::run_program (alias WasmVM)
  • Full standard library and host functions available
  • Suitable for daily development and behavior validation

3.2.2 Native pipeline (syx build --native, LLVM only) ​

Triggers: syx build --native [path] (optional --object, --release; see UsageGuide for full-native / local LLVM)

Source → … → Semantic → MIR → optimize
       → syx_llvm (MIR → LLVM IR / object)
       → link libsyx_rt.a → app (or --object for .o only)
  • Cranelift AOT removed; CLI no longer offers --backend=cranelift
  • syx-rt: C ABI runtime; syx-mir-run: shared MIR interpretation (WASM host, etc.)
  • Parity details: 10_BackendParity.md

3.2.3 WebAssembly pipeline ​

Triggers: syx build --wasm / syx run --wasm

Source → … → MIR → optimize
       → syx_wasm_emit::emit_wasm(MIR) → main.wasm
  • CLI syx run --wasm: guest + host syx.mir_exec (MirRuntime), close to native syx run
  • Browser syx-compiler-wasm / examples/wasm_web is a separate subset path; do not conflate with CLI WASM

4. Crate responsibilities ​

4.1 Frontend crates ​

CrateRoleKey types / APIs
syx-diagnosticsSource locations, spans, structured diagnosticsSourceFile, SyxDiagnostic, SyxResult
syx-lexerSingle-pass scan, keyword recognitionToken, Lexer::scan
syx-astAST nodes, visitor traitsModule, Decl, Expr, Stmt, ExprVisitor
syx-parserRecursive descent + Pratt expressionsParser::parse
syx-semanticTwo-pass analysis, scopes, type compatibilitySemanticAnalyzer, TypeId, Scope

4.2 Middle-end and backend crates ​

CrateRoleKey types / APIs
syx-mirAST lowering, CFG blocks, optimization passesMirModule, MirOp, lower_module, optimize
syx-codegenInstruction selection, function table buildCodeGenerator, CompiledProgram, Instruction
syx-vmStack interpreter, managed heap / GCVmInstance (WasmVM alias), Value
syx-stdlibBuiltin types/methods/host registrationHostFnId, MethodId, BUILTIN_TYPES, manifest
syx-llvmNative AOT (sole backend)MIR → LLVM / object → app
syx-wasm-emitMIR → WASM binaryemit_wasm
syx-cranelift-jitExperimental JIT tier-2 (opt-in)SYX_JIT_TIER2 / Suite-1; not AOT

4.3 Compile-time extension crates ​

CrateRoleDepth
syx-metaData class metadata, Pure/IO effect inference and checks, type reflectionP1 usable
syx-asyncawait site counting in async functions, Task runtime stubsP2 MVP

4.4 Toolchain crates ​

CrateRoleDepth
syx-fmtAST-driven source formattingP2 MVP
syx-lintNaming, duplicate defs, empty bodies, etc.P2 MVP
syx-docMarkdown API docs from ASTP2 MVP
syx-debugDebug sessions, breakpoint tables, DAP stubsP3 scaffolding

4.5 Orchestration and entry crates ​

CrateRole
syx-driverModule graph, cache, multi-backend dispatch, REPL, dependency management
syx-cliClap subcommands calling public syx-driver APIs

5. Compilation driver (syx-driver) ​

syx-driver is the core orchestration layer, exposing project- and file-level APIs.

5.1 Core data structures ​

TypeDescription
SyxManifestParsed syx.toml: name, version, main, dependencies
SyxLockfilesyx.lock pins dependency resolution
ModuleUnitSingle-module artifact: path, source, imports, CompiledProgram
ModuleGraphModule dependency graph: compile order + module table
CompiledProjectFull project: manifest + entry module + graph

5.2 Public API (selected) ​

FunctionPurpose
compile_file / compile_linkedSingle-file compile (recursive dependencies)
compile_projectCompile entire project from syx.toml
compile_with_cacheCompile with .sy-cache incremental cache
check_projectType-check only, no execution
run_file / run_projectCompile and run on VM
build_native / build_native_with_optionsMIR → native .o (LLVM via DriverOptions)
build_native_executableSame + link syx-rt → app
build_wasmMIR → main.wasm
repl_evalREPL single-line evaluation
format_project / lint_project / doc_projectToolchain operations
debug_projectCreate DebugSession (DAP breakpoints in syx-debug)
add_dependency / update_dependenciesWrite manifest and lockfile
reflect_type_infoQuery syx-meta registered type metadata

Three-backend debugging and linking: 12_BackendDebuggingGuide.md.

5.3 Compile orchestration ​

compile_module_recursive runs:

  1. Normalize paths; detect cycles (return if already in graph)
  2. Read source → Parser::parse
  3. apply_meta_passes (data classes, effects, pure-function checks)
  4. prepare_async_module (async/await constraints)
  5. Recursively compile modules referenced by import
  6. compile_file_with_context: merge import symbols → semantic analysis → codegen
  7. Record in ModuleGraph

compile_to_program chooses direct AST codegen or MIR based on SYX_USE_MIR.


6. Command-line tool (syx-cli) ​

syx-cli uses Clap derive macros to map user commands to syx-driver APIs.

6.1 Subcommands ​

CommandDescriptionDriver API
syx build [path]Compile file or project (VM bytecode)compile_project / compile_file
syx build --native [path]Build app (LLVM sole; --object for .o only)build_native_executable / build_native
syx build --wasm [path]Emit main.wasmbuild_wasm
syx run [path]Compile and runrun_project / run_file
syx check [path]Type-check onlycheck_project / compile_file
syx test [path]Run tests/**/*.sy (recursive) or project entry / single filerun_file loop / run_project
syx format [path]Format entry fileformat_project
syx lint [path]Static analysislint_project
syx debug [path]Start debug session summarydebug_project
syx replInteractive REPLrepl_eval
syx add <name> <path>Add dependencyadd_dependency
syx update [path]Refresh lockfileupdate_dependencies
syx doc [path]Generate docs/api.mddoc_project

6.2 Path resolution ​

  • Default path is current directory .
  • Directory: use main from syx.toml as entry
  • File: compile as a single unit

6.3 Build and install ​

bash
# Development
cargo run -p syx-cli -- run examples/hello.sy

# Install to PATH
cargo install --path crates/syx-cli
syx run examples/hello.sy

7. Module system and dependencies ​

7.1 Module syntax ​

swift
// math.sy
public func add(a: Int, b: Int) -> Int {
    return a + b
}

// main.sy
import math
func main() {
    print(math.add(1, 2))
}

7.2 Module resolution ​

resolve_module searches in order:

  1. Embedded stdlib (enable_std=true, default): math, io, etc.
  2. syx.lock installed deps: manifest package name → lock path / .sy/vendor/
  3. Same directory as importer: ./foo.sy
  4. --module-dir extra search paths

Projects with dependencies need syx install for a lock file, else P001. Missing module → M001.

7.3 Visibility ​

  • public declarations are importable from other modules
  • Non-public cross-module access → S005 (internal symbol access)
  • Semantic analysis merges export tables via import_exports

7.4 Manifest formats ​

syx.toml:

toml
name = "my-app"
version = "0.1.0"
main = "main.sy"

[dependencies.math]
version = "1.0"
path = "../math"

syx.lock:

toml
[packages.local_math]
source = "path"
version = "1.0.0"
path = "../deps_math"

Package management is in syx-pkg: install_project resolves path/git/registry deps and writes the lock; load_resolved_packages feeds the driver at compile time.

Registry API: GET /v1/packages/{name}, GET /v1/packages/{name}/{version}/download, PUT /v1/packages/{name}/{version} (publish). Local testing: file:///path/to/registry.


8. Incremental compilation cache ​

8.1 Cache layout ​

ItemDescription
Cache directory{project_root}/.sy-cache/
Cache file{sha256(source + "syx-cache-v1")}.bin
Serializationbincode CachedModuleUnit
PayloadPath, source, import list, CompiledProgram

8.2 Hit flow ​

compile_linked(path)
  → incremental_cache_path(root, path)
  → if .bin exists and bincode deserializes → return ModuleUnit
  → else full compile → write cache

8.3 Invalidation ​

Keys are source content hashes; edits invalidate automatically. Fine-grained cross-module invalidation is not implemented (dependency changes do not invalidate downstream caches; clear .sy-cache manually).

  • module_hash(path) — SHA-256 hash
  • incremental_cache_path(root, module) — cache file path
  • compile_with_cache(path, root) — explicit cached compile entry

9. Meta and async compile-time passes ​

9.1 Meta pass (syx-meta) ​

Invoked before semantic analysis via apply_meta_passes:

PassFunctionBehavior
Data class registrationregister_data_classesScan data class decls into global TYPE_REGISTRY
Effect inferencecheck_effectsInfer Pure/IO; name heuristics (e.g. fetch)
Pure function validationvalidate_pure_functionsrequires Pure bodies must not perform I/O → E001
Type reflectionreflect_typeDriver queries registered field metadata

P3 scaffolding APIs (not wired into main pipeline yet):

  • compile_time_eval — compile-time eval stub
  • type_level_contains — type-level constraint stub
  • service_wiring — Phase 125 Service DI v6: base/protocol polymorphic inject + field @Qualifier + @Primary + narrow @Around MVP (@Service/@Component instance methods, not AspectJ); M14 Di.withRequest / Qualifier/Primary/Profile inheritance

9.2 Async pass (syx-async) ​

Invoked before semantic analysis via prepare_async_module:

RuleCodeNotes
await only in async functionsA002Compile-time reject
At most one await per async functionA001MVP limit

Runtime pieces (P2 scaffolding):

  • Runtime — Future-based task queue
  • Task<T> — async task handle
  • blocking / blocking_poll — synchronous blocking stubs

10. Frontend: lexing, parsing, semantics ​

10.1 Lexer (syx-lexer) ​

  • Strategy: single-pass scan, O(1) keyword lookup
  • Locations: SourceFile::line_col for line/column reporting
  • Token classes: declarations, control flow, access control, operators, delimiters, literals (including string interpolation)

10.2 Parser (syx-parser) ​

  • Strategy: recursive descent + Pratt precedence climbing
  • Recovery: sync to statement boundaries; collect multiple syntax errors when possible
  • Features: functions, class/struct/enum, protocols, generics, closures, pattern matching, property wrappers, try-catch, import, etc.

10.3 Semantic analyzer (syx-semantic) ​

Two-pass analysis:

  1. Symbol collection: walk declarations; build global and export tables
  2. Detailed analysis: expression/statement typing, access control, method resolution

Type system (TypeId):

Void / Numeric(NumericKind) / Bool / String
Optional<T> / Array<T> / Set<T> / Dictionary<K,V>
Named(name) / Unknown

Platform Int/UInt resolve via syx-stdlib::numeric::PLATFORM_INT / PLATFORM_UINT on the compile host to concrete NumericKind.

Scope chain: nested Scope with parent for block and function scopes.

Imports: analyze_with_imports takes (module name, export table) pairs and validates cross-module references.


11. Code generation and intermediate representation ​

11.1 Direct AST codegen ​

CodeGenerator::compile_into walks the AST and emits VM instructions:

AST nodeTypical instructions
Binary numeric exprNumericAdd/Sub/Mul/Div (by NumericKind)
Numeric literalConstNumeric { kind, bits }
CastsNumericCast
CallsCall, MethodCall
Collection literalsArrayBuild, SetBuild, DictBuild
ConditionalsJumpIfFalse, Jump
LocalsStoreLocal
ReturnReturn

11.2 MIR ​

syx-mir lowers AST to SSA-style register IR:

  • MirOp: ConstI32, LoadLocal, Add, Call, JumpIfFalse, Return, etc.
  • MirBlock: basic block + successor edges
  • MirFunction: per-function ops and entry block

Optimization (optimize):

  • Constant folding
  • Dead code elimination
  • Peephole (local instruction merge)

11.3 Backend comparison ​

BackendInputOutputCompleteness
VM (codegen)AST or MIRCompiledProgramFull (P0/P1)
LLVMMIR.o or IR textMVP subset
WASMMIR.wasmMVP subset

12. Virtual machine and runtime ​

12.1 Execution model ​

VmInstance (alias WasmVM) uses stack interpretation:

Operand stack + locals + globals + function table

Example: a + b

[] → local_get(0) → [a] → local_get(1) → [a,b] → i32_add → [a+b]

12.2 Value representation ​

VariantMeaning
I32 / F64 / Bool / StrScalars
NilNull
ArrayDynamic array
ObjectKey/value (HTTP responses, etc.)
Iteratorfor-in state

12.3 Memory management ​

ComponentStrategy
MemoryPoolObject pool + free-list reuse
GcMark-sweep (simplified)
WeakReferenceWeak ref stub

12.4 JIT (P3 scaffolding) ​

syx-vm::jit::JitCompiler:

  • Hot-path counting (default threshold 1000 calls)
  • maybe_compile emits JIT stub bytes; not full native codegen yet
  • run_with_jit still falls back to interpretation after threshold

13. Standard library and host functions ​

13.1 Builtin types (syx-stdlib) ​

TypeExample methods
Int / Double / Bool / StringtoString, length, substring
Arraypush, pop, map, filter, len
Stringsplit, trim, hasPrefix, lowercased, matches
File / DirectoryVia host functions
HTTP / HTTPResponseget, post, json

13.2 Host function registration ​

Registered at VM startup in hosts.rs; semantic analysis validates via HostFnId:

Host FunctionSYX API
__syx_file_readFile.read(path)
__syx_file_writeFile.write(path, content)
__syx_file_existsFile.exists(path)
__syx_file_read_linesFile.readLines(path)
__syx_file_appendFile.append(path, content)
__syx_file_deleteFile.delete(path)
__syx_file_copyFile.copy(from, to)
__syx_file_moveFile.move(from, to)
__syx_dir_createDirectory.create(path)
__syx_dir_listDirectory.list(path)
__syx_dir_existsDirectory.exists(path)
__syx_http_getHTTP.get(url)
__syx_http_postHTTP.post(url, body)
__syx_http_response_jsonresponse.json()

HTTP uses reqwest (blocking + rustls); file I/O uses std::fs.

13.3 Iterator protocol ​

ITERATOR_PROTOCOL defines makeIterator / next; VM for-in drives Value::Iterator.


14. Toolchain crates (P2/P3) ​

14.1 syx-fmt ​

  • Parse to AST and re-emit with conventional style
  • Formats functions, imports, globals, control flow
  • format_project overwrites entry file in place

14.2 syx-lint ​

Sample rules:

CodeRule
L001Function names should start lowercase
L002Duplicate function names
L003Empty function body
L004public functions should declare return types
L005Async naming suggestions
L006Unused imports

14.3 syx-doc ​

  • Extract /// doc comments
  • Emit Markdown signature blocks for public functions/structs
  • Output to {project}/docs/api.md

14.4 syx-debug ​

  • DebugSession: PC, function index, breakpoints
  • Basic step / continue / stack_summary
  • DAP JSON message handling stubs

15. Error handling and diagnostics ​

15.1 Diagnostic stack ​

Rich reports via miette:

error[E0308]: type mismatch
  --> main.sy:5:10
   |
 5 |     let x: Int = "hello"
   |                  ^^^^^^^ expected `Int`, found `String`

15.2 Error categories ​

StageTypical codes
LexerInvalid character, unterminated string
ParserExpected token, sync recovery
SemanticS001 duplicate def, S005 internal access
MetaE001 pure function with I/O
AsyncA001/A002 await rules
ModulesM001 module not found
RuntimeVM underflow, cast failures

15.3 Recovery ​

  • Lexer: skip bad characters and continue
  • Parser: sync to statement boundaries
  • Semantic: collect all errors before returning
  • Runtime: try-catch, with finally at language level

16. Testing ​

16.1 Layout ​

crates/syx-driver/tests/
├── integration.rs           # Basic integration
├── p0_integration.rs        # P0 regression
├── p1_integration.rs        # P1 regression
├── p0_strings.sy
├── p0_arrays.sy
├── p0_file_io.sy
├── p0_http.sy
├── p0_modules.sy
├── p1_features.sy
├── p1_null.sy
└── p1_dataclass.sy

Per-crate #[cfg(test)] unit tests

16.2 P0 integration coverage ​

TestValidates
p0_demo_compilesExample project compiles
p0_strings_runString methods and interpolation
p0_arrays_runArrays and for-in
p0_file_io_runFile host functions
p0_http_compilesHTTP compiles
p0_modules_runCross-module public import
p0_modules_internal_rejectedInternal symbol rejected
p0_deps_project_*syx.toml dependency projects

16.3 P1 integration coverage ​

TestValidates
p1_features_compileguard let, effects, etc.
p1_null_runOptional null safety
p1_dataclass_rundata class and metadata registration

16.4 Benchmarks ​

crates/syx-driver/benches/compile_bench.rs — compile benchmarks (optional criterion).


17. Build and CI ​

17.1 Local build ​

bash
cargo build              # Debug
cargo build --release    # Release
cargo test --all         # All tests
cargo fmt --all          # Format
cargo clippy --all-targets --all-features -- -D warnings

17.2 Environment variables ​

VariableEffect
SYX_USE_MIR=1Enable MIR optimization pipeline

17.3 CI ​

GitHub Actions (.github/workflows/ci.yml):

  1. cargo fmt --all -- --check
  2. cargo clippy --all-targets --all-features
  3. cargo test --all

Uses Swatinem/rust-cache for dependency caching.


18. Appendix ​

Appendix A: Language feature matrix (Rust implementation) ​

FeatureStatusNotes
Scalar types✅Fixed-width numerics, platform Int/UInt, Bool, String
Collections✅Array<T>, Set<T>, [String: V] dictionary
Variables✅var, let
Functions✅func, params, return types
Class/struct/enum✅Basic OOP
Protocols/extensions⚠️Basic
Generics⚠️Basic
Closures⚠️Basic
Property observers⚠️willSet/didSet parsed
Property wrappers⚠️@ syntax parsed
Access control✅public/internal, etc.
Exceptions✅try/catch/throw
Optionals✅ P1?, !, ??, guard let
Arrays/dicts✅Basic collections
String interpolation✅ P0\(expr)
Regex✅ P0matches
Module import✅ P0public exports
File I/O✅ P0Host functions
HTTP✅ P0GET/POST
for-in✅ P0Arrays, string split results
data class✅ P1Metadata registration
Effects✅ P1requires Pure/IO
async/await⚠️ P2Syntax + checks; runtime stubs
MIR opts⚠️ P2Env var gated
fmt/lint/doc⚠️ P2MVP
LLVM native⚠️ P3MVP subset (sole AOT)
WASM backend⚠️ P3MVP subset
JIT❌ P3Hot-path counter stub only
Macros✅ M18syx-macro fixed-point expand + Service DI v9 (@Lazy, cycle lazy-proxy, proceed, @Bean, M17 inherited); see 19-macros.md · ADR-120
IDE/LSP❌Not implemented

Appendix B: Performance targets ​

MetricTargetCurrent
Compile throughput1000+ LOC/sPending benchmark
Compile memory< 100 MBLightweight Rust implementation
VM startup< 100 msMet
GC pause< 10 msSimplified GC; small heaps OK

Appendix C: Roadmap sketch ​

Near term (P1 finish)

  • Null safety and data class runtime polish
  • More lint rules and formatter coverage

Mid term (P2)

  • MIR on by default; more optimization passes
  • Full async/await runtime
  • DAP debugger polish

Long term (P3)

  • Full LLVM instruction coverage
  • WASM + WASI
  • Real JIT
  • LSP and IDE plugins

Document version: v2.0 (Rust implementation)
Last updated: 2026-06-14
Maintainer crate: syx-driver (orchestration entry)

SYX · Apache-2.0