2017-01-25 20:09:51 -08:00
|
|
|
use language::{ProgrammingLanguage, EvaluationMachine, ParseError, TokenError, LLVMCodeString};
|
|
|
|
|
|
|
|
pub struct Maaru {
|
2017-02-02 01:21:40 -08:00
|
|
|
}
|
2017-01-25 20:09:51 -08:00
|
|
|
|
2017-02-02 01:21:40 -08:00
|
|
|
impl Maaru {
|
|
|
|
pub fn new() -> Maaru {
|
|
|
|
Maaru { }
|
|
|
|
}
|
2017-01-25 20:09:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
2017-02-02 01:04:15 -08:00
|
|
|
fn name() -> String {
|
|
|
|
"Maaru".to_string()
|
|
|
|
}
|
|
|
|
|
2017-02-02 11:33:07 -08:00
|
|
|
fn tokenize(_input: &str) -> Result<Vec<Self::Token>, TokenError> {
|
2017-01-25 20:09:51 -08:00
|
|
|
Ok(vec![Token { }])
|
|
|
|
}
|
|
|
|
|
2017-02-02 11:33:07 -08:00
|
|
|
fn parse(_input: Vec<Self::Token>) -> Result<Self::AST, ParseError> {
|
2017-01-25 20:09:51 -08:00
|
|
|
Ok(AST { })
|
|
|
|
}
|
2017-02-02 11:33:07 -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()]
|
|
|
|
}
|
2017-02-02 11:33:07 -08:00
|
|
|
fn compile(_ast: Self::AST) -> LLVMCodeString {
|
2017-01-25 20:09:51 -08:00
|
|
|
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,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|