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.
Introduces the `Assign` AST node and a corresponding `assign` method on
the `Scope` struct. This allows for updating existing variables within
the current scope or any parent scope.
The `assign` method recursively traverses the scope chain until it finds
the variable or determines it's undefined. This enables reassigning
variables defined in outer scopes.
Introduces `UntypedKind::Lambda` to represent function closures.
Adds `parse_fn` to the parser to handle lambda syntax.
Updates `Node::eval` to correctly evaluate lambda expressions, creating
new scopes for each invocation with captured variables.
Improves handling of call expressions by passing the AST node's
identity.
Removes unnecessary comments and simplifies some error handling.
Introduces a `Scope` struct for dynamic scope management and a `Context`
struct to hold the current scope.
Implements a basic standard library with arithmetic operations and a
greater-than comparison.
Modifies `Node::eval` to handle identifiers by resolving them within the
current scope and `Call` nodes for function execution.
Updates the parser to use `Context::new()` for evaluating vector
elements, ensuring a fresh scope.
Enhances the main loop to handle potential runtime errors during
evaluation.
Introduces the lexer and parser modules, enabling the conversion of
source code into an Abstract Syntax Tree (AST).
This includes:
- Defining token kinds and structures.
- Implementing lexer logic to tokenize input.
- Defining AST node kinds and structures.
- Implementing parser logic to construct the AST from tokens.
- Adding support for basic expressions, lists, keywords, and
identifiers.
- Adding the `lazy_static` dependency for keyword interning.
- Refactoring `Value::Nil` to `Value::Void`.
Sets up the basic structure for the compiler GUI application using
eframe.
This includes the main application loop, a default UI layout with a
source code editor and an output log panel, and the foundational AST
(Abstract Syntax Tree) definitions for types, nodes, and an evaluation
mechanism.