This commit is contained in:
2024-12-21 03:22:07 +02:00
commit 54b6df5862
31 changed files with 2217 additions and 0 deletions

28
src/parser/ast/mod.rs Normal file
View File

@@ -0,0 +1,28 @@
use std::collections::HashMap;
use typ::Type;
pub use crate::tokeniser::tokentype::*;
pub mod expr;
pub mod literal;
pub mod statement;
pub mod typ;
#[derive(Debug, Clone)]
pub struct Program {
pub ast: expr::Block,
pub structs: HashMap<Ident, HashMap<Ident, usize>>,
pub enums: HashMap<Ident, usize>,
pub types: HashMap<Type, Type>,
pub functions: HashMap<Ident, (Vec<(Ident, Type)>, Type)>,
pub member_functions: HashMap<Ident, HashMap<Ident, (Vec<(Ident, Type)>, Type)>>,
}
#[derive(Debug, Clone)]
pub enum Ast {
Expr(expr::Expr),
Statement(statement::Statement),
}