parser in rust

This commit is contained in:
Sebastian Hugentobler 2025-02-10 14:36:55 +01:00
parent 4844e43447
commit ae959f7768
5 changed files with 337 additions and 5 deletions

View file

@ -0,0 +1,20 @@
use crate::token::{self, Token};
#[derive(Debug, Clone, PartialEq)]
pub enum Expression {
Binary {
left: Box<Expression>,
operator: Token,
right: Box<Expression>,
},
Grouping {
expression: Box<Expression>,
},
Literal {
value: token::Literal,
},
Unary {
operator: Token,
right: Box<Expression>,
},
}