iowo/crates/lang/src/main.rs
2024-06-23 20:53:05 +02:00

30 lines
692 B
Rust

use clap::Parser;
use std::{fs, path::PathBuf};
use lang::lst_parser::{self, grammar, input, output::Output, syntax_kind};
#[derive(Parser)]
struct Args {
file: PathBuf,
}
#[allow(clippy::unwrap_used)]
fn main() {
let args = Args::parse();
let n = args.file.clone();
let f = fs::read_to_string(n.clone()).expect("failed to read file");
let toks = dbg!(syntax_kind::lex(&f));
let input = input::Input::new(&toks);
let mut parser = lst_parser::Parser::new(input);
grammar::source_file(&mut parser);
let p_out = dbg!(parser.finish());
let o = Output::from_parser_output(toks, p_out);
println!("{}", o.debug_colored());
// World::new(n);
}