27 lines
978 B
Rust
27 lines
978 B
Rust
mod identification;
|
|
mod preprocessor;
|
|
mod testcases;
|
|
mod tokenizer;
|
|
|
|
use tokenizer::*;
|
|
|
|
fn main() {
|
|
let sample_code: String = std::fs::read_to_string("example.mlc").unwrap();
|
|
let mut example_tokenizer: Tokenizer = Tokenizer::new();
|
|
let mut meta_rules: crate::preprocessor::MetaRules =
|
|
crate::preprocessor::MetaRules::new("./language.toml");
|
|
let processed_sample_code: String = meta_rules.process(sample_code.to_owned());
|
|
example_tokenizer.read_configuration_from_file("./language.toml");
|
|
example_tokenizer.eat(processed_sample_code.as_str());
|
|
example_tokenizer.identify_tokens();
|
|
|
|
let mut example_identifier: identification::Identifier =
|
|
identification::Identifier::new(example_tokenizer.tokens);
|
|
example_identifier.load_criteria_from_configuration(example_tokenizer.configuration);
|
|
example_identifier.identify_identifiers();
|
|
|
|
for token in example_identifier.tokens.iter() {
|
|
print!("{}", token.token);
|
|
}
|
|
}
|