use std::{env::args, fs}; use tuker::{parser::Parser, tokenizer::Tokenizer}; // cargo run --example parser examples/inputs/lisp.toml examples/inputs/lisp_input.lisp fn main() { let args: Vec<_> = args().collect(); let table_path = args .get(1) .expect("Please provide two arguments, path_to_definition_file.toml and input_text"); let table_input = &fs::read_to_string(table_path) .unwrap_or_else(|e| panic!("Couldn't read table at {}: {e}", table_path)); let input_path = args .get(2) .expect("Please provide two arguments, path_to_definition_file.toml and input_text"); let input_text = fs::read_to_string(input_path) .unwrap_or_else(|e| panic!("Couldn't read input at {}: {e}", input_path)); let tokenizer = Tokenizer::from_toml(table_input).unwrap(); let tokens = tokenizer.tokenize_str(&input_text); let parser = Parser::from_toml(table_input, &tokenizer).unwrap(); let node = parser.parse_tokens("main", &tokens, &tokenizer); let _ = dbg!(node); }