How secona/belalang works
Project type and purpose
• This is a small interpreted programming language implemented in Rust.
• It uses a modular, multi‑crate workspace:
• belalang – the user‑facing CLI/repl/run binary
• belalang_compiler – the frontend (lexer, parser, AST, codegen)
• belalang_vm – the backend virtual machine (bytecode, opcode dispatch, memory)
• belalang_macros – supporting procedural macros (if any)
File structure
• Top‑level Cargo.toml defines a workspace that ties everything together.
• /crates/belalang contains the binary entrypoints (main.rs, repl.rs, run.rs).
• /crates/belalang_compiler is subdivided into:
• tokens (lexer)
• ast (parser & AST nodes)
• codegen (bytecode generation & disassembler)
• /crates/belalang_vm contains VM core (vm.rs), bytecode definitions, memory management modules (heap, stack), and builtin objects.
• /crates/belalang_macros holds any Rust proc‑macros used by the compiler or VM.
Essential details to capture
• The workspace relationship (root Cargo → individual crates).
• Build‑time vs. run‑time components (macros vs. VM).
• Data transformation pipeline from source code to program execution.
• Interaction between CLI and runtime engine.