Interpreter - WIP refactor to prepare for using resolved variables

This commit is contained in:
Emmanuel BENOîT 2023-01-05 07:54:18 +01:00
parent d528ce8dc3
commit 10223cbb4e
6 changed files with 104 additions and 79 deletions
src/interpreter

View file

@ -8,15 +8,15 @@ use crate::{
use super::{native_fn, CallableRef, Value};
/// A mutable reference to an environment.
pub type EnvironmentRef = Rc<RefCell<Environment>>;
pub(super) type EnvironmentRef = Rc<RefCell<Environment>>;
/// A variable.
pub type Variable = Option<Value>;
pub(super) type Variable = Option<Value>;
/// The execution environment.
#[derive(Debug)]
pub struct Environment {
enclosing: Option<EnvironmentRef>,
pub(super) struct Environment {
pub(super) enclosing: Option<EnvironmentRef>,
values: HashMap<String, Variable>,
}