Experiment to automatically generate parser
Gonna give this a shot, automatically generate a recursive-descent parser from BNF
This commit is contained in:
parent
64a3705e35
commit
aa40b985f3
@ -19,6 +19,7 @@ extern { }
|
|||||||
fn main() {
|
fn main() {
|
||||||
let generators: Vec<PLIGenerator> = vec![
|
let generators: Vec<PLIGenerator> = vec![
|
||||||
Box::new(|| { Box::new(schala_lang::Schala::new())}),
|
Box::new(|| { Box::new(schala_lang::Schala::new())}),
|
||||||
|
Box::new(|| { Box::new(schala_lang::autoparser::Schala::new())}),
|
||||||
Box::new(|| { Box::new(maaru_lang::Maaru::new())}),
|
Box::new(|| { Box::new(maaru_lang::Maaru::new())}),
|
||||||
Box::new(|| { Box::new(robo_lang::Robo::new())}),
|
Box::new(|| { Box::new(robo_lang::Robo::new())}),
|
||||||
Box::new(|| { Box::new(rukka_lang::Rukka::new())}),
|
Box::new(|| { Box::new(rukka_lang::Rukka::new())}),
|
||||||
|
25
src/schala_lang/autoparser.rs
Normal file
25
src/schala_lang/autoparser.rs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
use schala_lib::{ProgrammingLanguageInterface, EvalOptions, TraceArtifact, LanguageOutput};
|
||||||
|
|
||||||
|
use schala_lang::{tokenizing, parsing};
|
||||||
|
|
||||||
|
pub struct Schala { }
|
||||||
|
|
||||||
|
impl Schala {
|
||||||
|
pub fn new() -> Schala {
|
||||||
|
Schala { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ProgrammingLanguageInterface for Schala {
|
||||||
|
fn get_language_name(&self) -> String {
|
||||||
|
"Schala-autoparser".to_string()
|
||||||
|
}
|
||||||
|
fn get_source_file_suffix(&self) -> String {
|
||||||
|
format!("schala")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn evaluate_in_repl(&mut self, input: &str, options: &EvalOptions) -> LanguageOutput {
|
||||||
|
let mut output = LanguageOutput::default();
|
||||||
|
output
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,8 @@ macro_rules! bx {
|
|||||||
($e:expr) => { Box::new($e) }
|
($e:expr) => { Box::new($e) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub mod autoparser;
|
||||||
|
|
||||||
mod builtin;
|
mod builtin;
|
||||||
|
|
||||||
mod tokenizing;
|
mod tokenizing;
|
||||||
|
Loading…
Reference in New Issue
Block a user