Structures de base pour l'AST

This commit is contained in:
2024-04-29 08:36:53 +02:00
parent 5d5928d4ef
commit 0103749edd
2 changed files with 32 additions and 1 deletions

30
src/expr.rs Normal file
View File

@@ -0,0 +1,30 @@
use crate::token::Token;
pub struct Binary {
left: Expr,
operator: Token,
right: Expr,
}
pub struct Grouping {
expression: Expr,
}
pub enum Literal {
LiteralNumber(i8),
LiteralString(String),
LiteralBool(bool),
LiteralNil,
}
pub struct Unary {
operator: Token,
right: Expr,
}
pub enum Expr {
Binary ,
Grouping,
Literal,
Unary,
}