forge
This repository contains a minimal yet working compiler pipeline (lexer → parser → type checker → compiler → VM) implemented in Rust.
Requirements
- Rust (stable)
Build
On Windows and Linux (assuming Rust toolchain installed):
cargo build --releaseRun
Create a source file example.forge:
function main() { let x: int = 10; print(x);}Then run:
# run (compile & execute)forge run example.forgeOr build (bytecode kept in-memory in this minimal demo):
forge build example.forgeNotes
This implementation focuses on a small, clear pipeline and implements a subset of the requested language features suitable for CLI tools: functions, let, basic expressions, arrays (syntax parsed but not compiled), function calls and a built-in print.
The code is modular and can be extended to support enums, traits, structures, match, exhaustiveness checks, more bytecode instructions, and a real bytecode file format.
Исходный код · AGPL-3.0