parser beta
This commit is contained in:
+12
-4
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user