use std::fmt::Debug; #[derive(Debug)] pub struct TokenError { pub msg: String, } impl TokenError { pub fn new(msg: &str) -> TokenError { TokenError { msg: msg.to_string() } } } #[derive(Debug)] pub struct ParseError { pub msg: String, } pub struct LLVMCodeString(pub String); pub trait ProgrammingLanguage { type Token: Debug; type AST: Debug; fn tokenize(input: &str) -> Result, TokenError>; fn parse(input: Vec) -> Result; fn evaluate(ast: Self::AST, evaluator: &mut E) -> Vec; fn compile(ast: Self::AST) -> LLVMCodeString; } pub trait EvaluationMachine { fn set_option(&mut self, option: &str, value: bool) -> bool; fn new() -> Self; }