Some changes necessary to handle non-interactive code
This commit is contained in:
parent
7e23e40a2f
commit
64a3705e35
2
TODO.md
2
TODO.md
@ -42,3 +42,5 @@ struct CompilerPass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
-change "Type...." names in parser.rs to "Anno..." for non-collision with names in typechecking.rs
|
-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"
|
||||||
|
@ -18,7 +18,8 @@ pub struct EvalOptions {
|
|||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
pub struct LanguageOutput {
|
pub struct LanguageOutput {
|
||||||
output: String,
|
output: String,
|
||||||
artifacts: Vec<TraceArtifact>
|
artifacts: Vec<TraceArtifact>,
|
||||||
|
failed: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LanguageOutput {
|
impl LanguageOutput {
|
||||||
@ -91,6 +92,9 @@ impl TraceArtifact {
|
|||||||
|
|
||||||
pub trait ProgrammingLanguageInterface {
|
pub trait ProgrammingLanguageInterface {
|
||||||
fn evaluate_in_repl(&mut self, input: &str, eval_options: &EvalOptions) -> LanguageOutput;
|
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_language_name(&self) -> String;
|
||||||
fn get_source_file_suffix(&self) -> String;
|
fn get_source_file_suffix(&self) -> String;
|
||||||
fn compile(&mut self, _input: &str) -> LLVMCodeString {
|
fn compile(&mut self, _input: &str) -> LLVMCodeString {
|
||||||
|
@ -197,8 +197,8 @@ impl Repl {
|
|||||||
|
|
||||||
fn input_handler(&mut self, input: &str) -> String {
|
fn input_handler(&mut self, input: &str) -> String {
|
||||||
let ref mut language = self.languages[self.current_language_index];
|
let ref mut language = self.languages[self.current_language_index];
|
||||||
let interpretor_output = language.evaluate_in_repl(input, &self.options);
|
let interpreter_output = language.evaluate_in_repl(input, &self.options);
|
||||||
interpretor_output.to_string()
|
interpreter_output.to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_interpreter_directive(&mut self, input: &str) -> bool {
|
fn handle_interpreter_directive(&mut self, input: &str) -> bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user