From 6140de9f9c5912da9f0242414efb2783f57e1072 Mon Sep 17 00:00:00 2001 From: greg Date: Fri, 9 Mar 2018 00:50:06 -0800 Subject: [PATCH] Some changes necessary to handle non-interactive code --- TODO.md | 2 ++ schala-lib/src/language.rs | 6 +++++- schala-lib/src/lib.rs | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/TODO.md b/TODO.md index 4cc369d..a0f51c0 100644 --- a/TODO.md +++ b/TODO.md @@ -42,3 +42,5 @@ struct CompilerPass { } -change "Type...." names in parser.rs to "Anno..." for non-collision with names in typechecking.rs + +-get rid of code pertaining to compilation specifically, have a more generation notion of "execution type" diff --git a/schala-lib/src/language.rs b/schala-lib/src/language.rs index f554b4b..e44fd18 100644 --- a/schala-lib/src/language.rs +++ b/schala-lib/src/language.rs @@ -18,7 +18,8 @@ pub struct EvalOptions { #[derive(Debug, Default)] pub struct LanguageOutput { output: String, - artifacts: Vec + artifacts: Vec, + failed: bool, } impl LanguageOutput { @@ -91,6 +92,9 @@ impl TraceArtifact { pub trait ProgrammingLanguageInterface { fn evaluate_in_repl(&mut self, input: &str, eval_options: &EvalOptions) -> LanguageOutput; + fn evaluate_noninteractive(&mut self, input: &str, eval_options: &EvalOptions) -> LanguageOutput { + self.evaluate_in_repl(input, eval_options) + } fn get_language_name(&self) -> String; fn get_source_file_suffix(&self) -> String; fn compile(&mut self, _input: &str) -> LLVMCodeString { diff --git a/schala-lib/src/lib.rs b/schala-lib/src/lib.rs index 260183a..573a410 100644 --- a/schala-lib/src/lib.rs +++ b/schala-lib/src/lib.rs @@ -197,8 +197,8 @@ impl Repl { fn input_handler(&mut self, input: &str) -> String { let ref mut language = self.languages[self.current_language_index]; - let interpretor_output = language.evaluate_in_repl(input, &self.options); - interpretor_output.to_string() + let interpreter_output = language.evaluate_in_repl(input, &self.options); + interpreter_output.to_string() } fn handle_interpreter_directive(&mut self, input: &str) -> bool {