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:
@@ -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::*;
|
||||
|
||||
Reference in New Issue
Block a user