Runtime
Runtime
Section titled “Runtime”The runtime defines values that exist while an NXL program executes.
Currently:
pub enum Value { Number(f64), String(String), Boolean(bool), Null,}For:
let age = 23the runtime can hold:
Value::Number(23.0)For:
let name = "Tanmoy"it holds:
Value::String("Tanmoy")Environment
Section titled “Environment”The environment stores variables:
Environment
name → "Tanmoy"age → 23It uses a hash map internally.
Define
Section titled “Define”define("age", Value::Number(23))get("age")returns:
Value::Number(23)Assignment
Section titled “Assignment”The environment also has an assign() operation for updating existing variables.
Parent environments
Section titled “Parent environments”Environments support parent scopes, allowing nested scopes to resolve values from outer scopes.