Initial commit: WAFER (WebAssembly Forth Engine in Rust)

Optimizing Forth 2012 compiler targeting WebAssembly with IR-based
compilation pipeline, multi-typed stack inference, subroutine threading,
and JIT/consolidation modes. Rust kernel with ~35 primitives and Forth
standard library for core/core-ext word sets.
This commit is contained in:
2026-03-29 22:14:53 +02:00
commit 683281363d
33 changed files with 5084 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
//! WASM code generation from IR.
//!
//! Translates optimized IR into WASM bytecode using the `wasm-encoder` crate.
//! Supports two modes:
//! - **Typed mode**: when type inference succeeds, values stay in WASM locals
//! - **Fallback mode**: load/store against stack pointer globals in linear memory
// TODO: Step 5 - Full codegen implementation
// - IR -> WASM function body translation
// - Single-word module generation (JIT mode)
// - Multi-word module generation (AOT/consolidation mode)
// - Typed vs fallback mode selection
// - Function table management
#[cfg(test)]
mod tests {
#[test]
fn placeholder() {
// Codegen tests will be added in Step 5
}
}