2017-01-25 20:09:51 -08:00
|
|
|
use language::{ProgrammingLanguage, EvaluationMachine, ParseError, TokenError, LLVMCodeString};
|
|
|
|
|
|
|
|
pub struct Maaru {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct MaaruEvaluator {
|
|
|
|
pub trace_evaluation: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
2017-01-28 21:00:31 -08:00
|
|
|
pub struct Token { }
|
2017-01-25 20:09:51 -08:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
2017-01-28 21:00:31 -08:00
|
|
|
pub struct AST { }
|
2017-01-25 20:09:51 -08:00
|
|
|
|
2017-01-31 00:53:31 -08:00
|
|
|
impl ProgrammingLanguage for Maaru {
|
2017-01-25 20:09:51 -08:00
|
|
|
type Token = Token;
|
|
|
|
type AST = AST;
|
2017-01-31 00:53:31 -08:00
|
|
|
type Evaluator = MaaruEvaluator;
|
2017-01-25 20:09:51 -08:00
|
|
|
|
|
|
|
fn tokenize(input: &str) -> Result<Vec<Self::Token>, TokenError> {
|
|
|
|
Ok(vec![Token { }])
|
|
|
|
}
|
|
|
|
|
|
|
|
fn parse(input: Vec<Self::Token>) -> Result<Self::AST, ParseError> {
|
|
|
|
Ok(AST { })
|
|
|
|
}
|
2017-01-31 00:53:31 -08:00
|
|
|
fn evaluate(ast: Self::AST, evaluator: &mut Self::Evaluator) -> Vec<String> {
|
2017-01-25 20:09:51 -08:00
|
|
|
vec!["Unimplemented".to_string()]
|
|
|
|
}
|
|
|
|
fn compile(ast: Self::AST) -> LLVMCodeString {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl EvaluationMachine for MaaruEvaluator {
|
|
|
|
fn set_option(&mut self, option: &str, value: bool) -> bool {
|
|
|
|
if option == "trace_evaluation" {
|
|
|
|
self.trace_evaluation = value;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
false
|
|
|
|
}
|
|
|
|
|
|
|
|
fn new() -> MaaruEvaluator {
|
|
|
|
MaaruEvaluator {
|
|
|
|
trace_evaluation: false,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|