feat: Implement AST binder and VM

Adds a new `Binder` struct that traverses the AST and resolves variable
references to concrete `Address` types (Local, Upvalue, Global). This
information is crucial for the Virtual Machine's execution phase.

Introduces the `BoundKind` enum to represent the AST after binding.

The `VM` is updated to handle `BoundKind` nodes and execute the bound
AST.
It now manages a call stack, local variables, and closures for function
calls and upvalue capturing.

The `Environment` struct is enhanced to manage global variables and
provide
a unified interface for parsing, binding, and executing scripts. It also
includes basic standard library functions.
This commit is contained in:
Michael Schimmel
2026-02-17 02:00:51 +01:00
parent 874a6f39a4
commit 7042206ab6
8 changed files with 595 additions and 29 deletions
+6
View File
@@ -2,8 +2,14 @@ pub mod types;
pub mod nodes;
pub mod lexer;
pub mod parser;
pub mod compiler;
pub mod vm;
pub mod environment;
pub use types::*;
pub use nodes::*;
pub use lexer::*;
pub use parser::*;
pub use compiler::*;
pub use vm::*;
pub use environment::*;