parse hello world

This commit is contained in:
nora 2022-07-08 22:15:29 +02:00
parent 727cfc692c
commit f229dd7fdc
7 changed files with 239 additions and 29 deletions

View file

@ -78,11 +78,27 @@ pub struct ExprBinary {
pub op: BinaryOp,
}
#[derive(Debug, DebugPls)]
pub enum PostfixOp {
Call(Vec<Spanned<Expr>>),
Member(Ident),
ArrowMember(Ident),
Increment,
Decrement,
}
#[derive(Debug, DebugPls)]
pub struct ExprPostfix {
pub lhs: Box<Spanned<Expr>>,
pub op: PostfixOp,
}
#[derive(Debug, DebugPls)]
pub enum Expr {
Atom(Atom),
Unary(ExprUnary),
Binary(ExprBinary),
Postfix(ExprPostfix),
}
//
@ -92,7 +108,10 @@ pub enum Expr {
#[derive(Debug, DebugPls)]
pub enum Stmt {
Decl(Decl),
Labeled{label: Ident, stmt: Box<Spanned<Stmt>>},
Labeled {
label: Ident,
stmt: Box<Spanned<Stmt>>,
},
Compound(Vec<Spanned<Stmt>>),
If {
cond: Expr,