Skip to content
Snippets Groups Projects
Commit a9eea125 authored by MarvelousAnything's avatar MarvelousAnything
Browse files

Worked on ast.

parent 24a472be
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,9 @@ fn main() {
let tokens = lexer.lex(source);
match tokens {
Ok(tokens) => {
for token in &tokens.tokens {
info!("{:?}", token);
}
println!("Keywords:\n{}", tokens.get_keywords());
println!("Identifiers:\n{}", tokens.get_identifiers());
println!("Integers:\n{}", tokens.get_integer_literals());
......
mod node;
// mod node;
//
// pub enum Program {
// VarList(Vec<Var>),
// FunList(Vec<Fun>),
// }
//
// pub struct ID {
// pub name: String,
// }
//
// pub struct Var {
// pub name: String,
// pub value: Option<Expr>,
// }
//
// pub struct Fun {
// pub name: String,
// pub params: Vec<ID>,
// pub body: Vec<Stmt>,
// }
\ No newline at end of file
pub struct Node<'a> {
pub op: i32,
pub val: String,
pub sym: IdList,
pub fnum: i32,
pub line_no: i32,
pub left: &'a Node<'a>,
pub right: &'a Node<'a>,
pub next: &'a Node<'a>,
}
pub struct IdList {}
mod ast;
pub mod lex;
mod parser;
extern crate pretty_env_logger;
#[macro_use] extern crate log;
\ No newline at end of file
use crate::lex::lexer::TokenStream;
pub struct Parser {
tokens: TokenStream,
}
impl Parser {
// This should parse a token stream into an AST.
pub fn parse(tokens: TokenStream) {
todo!("Implement parser");
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment