Forgot to add mod.rs file

This commit is contained in:
greg 2017-01-23 11:27:11 -08:00
parent 1a4bf24ab1
commit 5103f03fa5

28
src/schala_lang/mod.rs Normal file
View File

@ -0,0 +1,28 @@
pub mod tokenizer;
pub mod parser;
pub mod eval;
pub mod compilation;
use language::{ProgrammingLanguage, ParseError, TokenError};
pub struct Schala { }
impl<'a> ProgrammingLanguage<eval::Evaluator<'a>> for Schala {
type Token = tokenizer::Token;
type AST = parser::AST;
fn tokenize(input: &str) -> Result<Vec<Self::Token>, TokenError> {
tokenizer::tokenize(input).map_err(|x| TokenError { msg: x.msg })
}
fn parse(input: Vec<Self::Token>) -> Result<Self::AST, ParseError> {
parser::parse(&input, &[]).map_err(|x| ParseError { msg: x.msg })
}
fn evaluate(ast: Self::AST, evaluator: &mut eval::Evaluator) -> Vec<String> {
evaluator.run(ast)
}
fn compile(ast: Self::AST) -> String {
compilation::compile_ast(ast)
}
}