Added super-janky prelude capability

This commit is contained in:
greg 2018-06-03 18:43:31 -07:00
parent ff5446af3f
commit 25790f8643
1 changed files with 10 additions and 1 deletions

View File

@ -40,7 +40,7 @@ pub struct Schala {
} }
impl Schala { impl Schala {
pub fn new() -> Schala { fn new_blank_env() -> Schala {
let symbols = Rc::new(RefCell::new(symbol_table::SymbolTable::new())); let symbols = Rc::new(RefCell::new(symbol_table::SymbolTable::new()));
Schala { Schala {
symbol_table: symbols.clone(), symbol_table: symbols.clone(),
@ -48,6 +48,15 @@ impl Schala {
state: eval::State::new(symbols), state: eval::State::new(symbols),
} }
} }
pub fn new() -> Schala {
let prelude = r#"
type Option<T> = Some(T) | None
"#;
let mut s = Schala::new_blank_env();
s.execute_pipeline(prelude, &EvalOptions::default());
s
}
} }
fn tokenizing(_handle: &mut Schala, input: &str, comp: Option<&mut UnfinishedComputation>) -> Result<Vec<tokenizing::Token>, String> { fn tokenizing(_handle: &mut Schala, input: &str, comp: Option<&mut UnfinishedComputation>) -> Result<Vec<tokenizing::Token>, String> {