parser beta

This commit is contained in:
2024-04-02 21:49:30 +02:00
parent 17b4ee7ef0
commit 55fe45717c
3 changed files with 110 additions and 10 deletions
+12 -4
View File
@@ -1,11 +1,19 @@
mod lexer;
use lexer::lex;
mod parser;
use parser::parse;
fn main() {
let input = "int test() {}";
let input = "int main() {";
// let input = "test->xy";
let tokens = lex(input, true);
for token in tokens {
println!("{:?} {}", token.token_type, token.token_value);
let mut tokens = lex(input, false);
let ast = *parse(&mut tokens);
for t in tokens {
println!("{:?}", t);
}
let mut _x = 1;
for a in ast {
println!("{:?}: {:?}", a.type_, a.values);
_x+=1;
}
}