From 25790f8643acac0f4ddd853d8f5bf675d61aef48 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 3 Jun 2018 18:43:31 -0700 Subject: [PATCH] Added super-janky prelude capability --- schala-lang/src/lib.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/schala-lang/src/lib.rs b/schala-lang/src/lib.rs index f974559..176b8fd 100644 --- a/schala-lang/src/lib.rs +++ b/schala-lang/src/lib.rs @@ -40,7 +40,7 @@ pub struct Schala { } impl Schala { - pub fn new() -> Schala { + fn new_blank_env() -> Schala { let symbols = Rc::new(RefCell::new(symbol_table::SymbolTable::new())); Schala { symbol_table: symbols.clone(), @@ -48,6 +48,15 @@ impl Schala { state: eval::State::new(symbols), } } + + pub fn new() -> Schala { + let prelude = r#" +type Option = 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, String> {