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:
@@ -0,0 +1,41 @@
|
||||
//! WAFER CLI: Interactive REPL and AOT compiler for WAFER Forth.
|
||||
|
||||
use clap::Parser;
|
||||
|
||||
/// WAFER: WebAssembly Forth Engine in Rust
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(name = "wafer", version, about)]
|
||||
struct Cli {
|
||||
/// Forth source file to execute
|
||||
file: Option<String>,
|
||||
|
||||
/// Compile all words into a single optimized WASM module
|
||||
#[arg(long)]
|
||||
consolidate: bool,
|
||||
|
||||
/// Output file for consolidated WASM (requires --consolidate)
|
||||
#[arg(short, long)]
|
||||
output: Option<String>,
|
||||
}
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let cli = Cli::parse();
|
||||
|
||||
match cli.file {
|
||||
Some(ref _file) => {
|
||||
// TODO: Step 9 - Load and execute Forth file
|
||||
eprintln!("WAFER: file execution not yet implemented");
|
||||
}
|
||||
None => {
|
||||
// TODO: Step 9 - Interactive REPL
|
||||
println!(
|
||||
"WAFER v{} - WebAssembly Forth Engine in Rust",
|
||||
env!("CARGO_PKG_VERSION")
|
||||
);
|
||||
println!("Type BYE to exit.");
|
||||
eprintln!("REPL not yet implemented");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user