Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub enum StatementNode {
- Function(Function),
- WhileLoop(WhileLoop),
- Constant(Constant),
- }
- pub enum ExpressionNode {
- BinOp((Box<ExpressionNode>, BinOp, Box<ExpressionNode>)),
- Constant(Constant),
- }
- pub enum BinOp {
- Add,
- Sub,
- Div,
- Mul,
- }
- pub struct WhileLoop {
- pub condition: ExpressionNode,
- pub body: Vec<StatementNode>,
- }
- pub enum Constant {
- Int(i32),
- Str(String),
- Bool(bool),
- }
- pub enum VarType {
- Int,
- Str,
- Bool,
- }
- pub struct Function {
- pub ident: String,
- pub params: Vec<Parameter>,
- pub body: Vec<StatementNode>,
- }
- pub struct Parameter {
- pub ident: String,
- pub ty: VarType,
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement