Implemented SymTable optimization for efficient variable updates
This commit is contained in:
parent
dcb2969b0a
commit
381852b3bd
9 changed files with 122 additions and 23 deletions
47
src/stl.rs
47
src/stl.rs
|
|
@ -38,6 +38,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: append::CONS_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(append::cons_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -49,6 +50,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: strings::ECHO_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(strings::echo_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -60,6 +62,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: strings::CONCAT_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(strings::concat_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -71,6 +74,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: strings::CONTAINS_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(strings::contains_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -82,6 +86,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: strings::SPLIT_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(strings::split_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -93,6 +98,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: strings::STRLEN_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(strings::strlen_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -104,6 +110,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: strings::STRCAST_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(strings::strcast_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -115,6 +122,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: true,
|
||||
docs: control::IF_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(control::if_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -126,6 +134,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: true,
|
||||
docs: control::LET_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(control::let_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -137,6 +146,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: true,
|
||||
docs: control::WHILE_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(control::while_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -148,6 +158,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: true,
|
||||
docs: control::CIRCUIT_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(control::circuit_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -159,6 +170,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: boolean::AND_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(boolean::and_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -170,6 +182,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: boolean::BOOLCAST_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(boolean::boolcast_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -181,6 +194,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: boolean::OR_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(boolean::or_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -192,6 +206,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: boolean::NOT_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(boolean::not_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -203,6 +218,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: boolean::ISEQ_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(boolean::iseq_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -214,6 +230,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: true,
|
||||
docs: boolean::TOGGLE_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(boolean::toggle_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -225,6 +242,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: true,
|
||||
docs: decl::HELP_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(decl::help_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -236,6 +254,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: true,
|
||||
docs: decl::ISSET_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(decl::isset_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -247,6 +266,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: decl::ENV_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(decl::env_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -258,6 +278,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: math::ADD_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(math::add_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -269,6 +290,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: math::SUB_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(math::sub_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -280,6 +302,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: math::DIV_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(math::div_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -291,6 +314,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: math::MUL_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(math::mul_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -302,6 +326,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: math::INTCAST_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(math::intcast_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -313,6 +338,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: math::FLOATCAST_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(math::floatcast_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -324,6 +350,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: append::LEN_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(append::len_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -335,6 +362,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: append::CAR_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(append::car_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -346,6 +374,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: append::CDR_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(append::cdr_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -357,6 +386,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: append::POP_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(append::pop_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -368,6 +398,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: append::DEQUEUE_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(append::dequeue_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -379,6 +410,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: append::REVERSE_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(append::reverse_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -390,6 +422,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: math::EXP_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(math::exp_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -401,6 +434,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: math::MOD_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(math::mod_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -412,6 +446,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: math::ISGT_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(math::isgt_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -423,6 +458,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: math::ISLT_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(math::islt_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -434,6 +470,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: math::ISGTE_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(math::isgte_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -445,6 +482,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: math::ISLTE_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(math::islte_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -456,6 +494,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: true,
|
||||
docs: math::INC_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(math::inc_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -467,6 +506,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: true,
|
||||
docs: math::DEC_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(math::dec_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -478,6 +518,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: true,
|
||||
docs: decl::QUOTE_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(decl::quote_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -489,6 +530,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: true,
|
||||
docs: decl::QUOTE_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(decl::quote_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -500,6 +542,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: true,
|
||||
docs: decl::EVAL_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(decl::eval_callback)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -511,6 +554,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: true,
|
||||
docs: decl::LAMBDA_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(decl::lambda_callback)),
|
||||
..Default::default()
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -522,6 +566,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: decl::GETDOC_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(decl::getdoc_callback)),
|
||||
..Default::default()
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -533,6 +578,7 @@ pub fn static_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
conditional_branches: false,
|
||||
docs: decl::SETDOC_DOCSTRING.to_string(),
|
||||
value: ValueType::Internal(Rc::new(decl::setdoc_callback)),
|
||||
..Default::default()
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -562,6 +608,7 @@ pub fn dynamic_stdlib(syms: &mut SymTable) -> Result<(), String> {
|
|||
decl::store_callback(ast, syms, env_cfg_user_form)
|
||||
},
|
||||
)),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue