2017-01-21 14:34:17 -08:00
|
|
|
use std::fmt::Debug;
|
2017-01-21 01:49:45 -08:00
|
|
|
|
2017-01-23 19:51:27 -08:00
|
|
|
#[derive(Debug)]
|
2017-01-21 01:49:45 -08:00
|
|
|
pub struct TokenError {
|
|
|
|
pub msg: String,
|
|
|
|
}
|
|
|
|
|
2017-01-23 19:45:26 -08:00
|
|
|
impl TokenError {
|
|
|
|
pub fn new(msg: &str) -> TokenError {
|
|
|
|
TokenError { msg: msg.to_string() }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-23 19:51:27 -08:00
|
|
|
#[derive(Debug)]
|
2017-01-21 01:49:45 -08:00
|
|
|
pub struct ParseError {
|
|
|
|
pub msg: String,
|
|
|
|
}
|
|
|
|
|
2017-01-23 19:11:50 -08:00
|
|
|
pub struct LLVMCodeString(pub String);
|
|
|
|
|
2017-08-30 22:58:57 -07:00
|
|
|
#[derive(Debug, Default)]
|
2017-08-30 19:09:22 -07:00
|
|
|
pub struct EvalOptions {
|
2017-08-30 19:15:04 -07:00
|
|
|
pub debug_tokens: bool,
|
|
|
|
pub debug_parse: bool,
|
|
|
|
pub debug_type: bool,
|
2017-08-31 16:26:55 -07:00
|
|
|
pub trace_evaluation: bool,
|
2017-08-30 19:09:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
pub trait ProgrammingLanguageInterface {
|
2017-08-30 19:15:04 -07:00
|
|
|
fn evaluate_in_repl(&mut self, input: &str, eval_options: EvalOptions) -> Vec<String>;
|
2017-08-30 19:09:22 -07:00
|
|
|
fn get_language_name(&self) -> String;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait CompileableLanguage : ProgrammingLanguageInterface {
|
2017-08-30 19:15:04 -07:00
|
|
|
fn compile(&mut self) -> LLVMCodeString;
|
2017-08-30 19:09:22 -07:00
|
|
|
}
|