Starting eval framework
This commit is contained in:
parent
6b9fee1aed
commit
8d2a65b44e
15
src/schala_lang/eval.rs
Normal file
15
src/schala_lang/eval.rs
Normal file
@ -0,0 +1,15 @@
|
||||
use schala_lang::parsing::AST;
|
||||
|
||||
pub struct ReplState {
|
||||
}
|
||||
|
||||
impl ReplState {
|
||||
pub fn new() -> ReplState {
|
||||
ReplState { }
|
||||
}
|
||||
|
||||
pub fn evaluate(&mut self, ast: AST) -> String {
|
||||
format!("Evaluated AST: {:?}", ast)
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,17 @@ use itertools::Itertools;
|
||||
use language::{ProgrammingLanguageInterface, EvalOptions, TraceArtifact, ReplOutput};
|
||||
|
||||
mod parsing;
|
||||
mod eval;
|
||||
|
||||
pub struct Schala {
|
||||
state: eval::ReplState
|
||||
}
|
||||
|
||||
impl Schala {
|
||||
pub fn new() -> Schala {
|
||||
Schala { }
|
||||
Schala {
|
||||
state: eval::ReplState::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +53,7 @@ impl ProgrammingLanguageInterface for Schala {
|
||||
}
|
||||
};
|
||||
|
||||
let evaluation_output = format!("{:?}", ast);
|
||||
let evaluation_output = self.state.evaluate(ast);
|
||||
output.add_output(evaluation_output);
|
||||
return output;
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ impl Parser {
|
||||
_ => None
|
||||
};
|
||||
if let Some(a) = expr_body.1 {
|
||||
panic!("UNexpected thing {:?}", a);
|
||||
return ParseError::new("Bad parse state");
|
||||
}
|
||||
expr_body.1 = type_anno;
|
||||
Ok(expr_body)
|
||||
|
Loading…
Reference in New Issue
Block a user