Introduce Value::Cell for mutable upvalues, allowing closures to

modify captured variables.
Implement `capture_upvalue` and `get_value`/`set_value` methods in the
`VM` to handle these mutable upvalues.

Refactor number parsing to support integers and floats

Separate the `TokenKind::Number` into `TokenKind::Integer` and
`TokenKind::Float`.
Update the lexer to distinguish between integer and float literals.
Update the parser to correctly map these new token kinds to their
respective `Value` types.

Add integration tests for parsing integers and floats, and for closure
modification of captured variables.
This commit is contained in:
Michael Schimmel
2026-02-17 12:35:39 +01:00
parent 12791a7f8f
commit ce166f39e3
6 changed files with 289 additions and 16 deletions
+2
View File
@@ -2,6 +2,8 @@ use eframe::egui;
use crate::ast::environment::Environment;
pub mod ast;
#[cfg(test)]
mod integration_test;
fn main() -> eframe::Result {
let options = eframe::NativeOptions {