diff --git a/src/language.rs b/src/language.rs index 930529b..b07c107 100644 --- a/src/language.rs +++ b/src/language.rs @@ -46,7 +46,7 @@ pub trait LanguageInterface { fn evaluate_in_repl(&mut self, input: &str, options: LanguageInterfaceOptions) -> String; } -impl LanguageInterface for PL where PL: ProgrammingLanguage, T: Debug, A: Debug, E: EvaluationMachine { +impl LanguageInterface for (PL, PL::Evaluator) where PL: ProgrammingLanguage, T: Debug, A: Debug, E: EvaluationMachine { fn evaluate_in_repl(&mut self, input: &str, options: LanguageInterfaceOptions) -> String { let mut output = String::new(); @@ -79,8 +79,8 @@ impl LanguageInterface for PL where PL: ProgrammingLanguage = PL::evaluate(ast, &mut evaluator); + let ref mut evaluator = self.1; + let mut full_output: Vec = PL::evaluate(ast, evaluator); output.push_str(&full_output.pop().unwrap_or("".to_string())); } output diff --git a/src/main.rs b/src/main.rs index 9c4badf..dc34928 100644 --- a/src/main.rs +++ b/src/main.rs @@ -116,7 +116,7 @@ impl<'a> Repl<'a> { show_tokens: false, show_parse: false, show_llvm_ir: show_llvm, - languages: vec![Box::new(Schala::new())], + languages: vec![Box::new((Schala::new(), SchalaEvaluator::new(None)))], evaluator: evaluator, interpreter_directive_sigil: '.', reader: reader,