src/lexer.rs: implement a naive and dumb lexer

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2023-04-08 02:10:57 +05:30
parent 6979a02408
commit 0d7a4bdd4e
3 changed files with 393 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ use std::fs;
use std::panic;
use tricc::args::Args;
use tricc::lexer::Lexer;
fn main() {
panic::set_hook(Box::new(|panic_info| {
@@ -25,4 +26,9 @@ fn main() {
let file = args.get_file();
let contents = fs::read_to_string(&file).expect("Couldn't read the file");
let mut lexer = Lexer::new(&file, contents.as_str());
let tokens = lexer.lex();
println!("{:?}", tokens);
}