basic jit
This commit is contained in:
parent
374daaff7f
commit
511be952aa
16 changed files with 971 additions and 495 deletions
34
src/ast/expr.rs
Normal file
34
src/ast/expr.rs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
use crate::ast::*;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Expr {
|
||||
BinaryExpression {
|
||||
lhs: Box<Expr>,
|
||||
op: BinaryOperator,
|
||||
rhs: Box<Expr>,
|
||||
typ: Type,
|
||||
},
|
||||
UnaryExpression {
|
||||
op: UnaryOperator,
|
||||
inner: Box<Expr>,
|
||||
},
|
||||
Identifier {
|
||||
name: String,
|
||||
typ: Type,
|
||||
},
|
||||
Call(Box<Call>),
|
||||
Block(Box<Block>),
|
||||
/// Last field is either Expr::Block or Expr::IfExpr
|
||||
IfExpr {
|
||||
cond: Box<Expr>,
|
||||
then_body: Box<Block>,
|
||||
else_body: Box<Expr>,
|
||||
typ: Type,
|
||||
},
|
||||
// Literals
|
||||
UnitLiteral,
|
||||
BooleanLiteral(bool),
|
||||
IntegerLiteral(i64),
|
||||
FloatLiteral(f64),
|
||||
StringLiteral(String),
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue