Skip to content

Instantly share code, notes, and snippets.

@lantos1618
Last active March 7, 2024 10:23
Show Gist options
  • Save lantos1618/09eebea2a7d08e1bfc9429138a97137d to your computer and use it in GitHub Desktop.
Save lantos1618/09eebea2a7d08e1bfc9429138a97137d to your computer and use it in GitHub Desktop.
// Literal:
// IntLiteral(int),
// FloatLiteral(float),
// BoolLiteral(bool),
// StringLiteral(string)
// Variable:
// name: string
// type: TypeDesc
// Assign:
// name: string,
// value: Expr
// BinaryOp:
// Add,
// Sub,
// ...
// Binary:
// op: BinaryOp,
// lhs: Expr,
// rhs: Expr
// Block: [Expr]
// If:
// cond: Expr,
// then: Block,
// else: Option<Block>
// Loop:
// cond: Expr,
// body: Block
// TypeDesc:
// IntKind,
// FloatKind,
// BoolKind,
// StringKind,
// VoidKind,
// ArrayKind(TypeDesc),
// FuncKind([TypeDesc], TypeDesc)
// StructKind(string, [FieldDesc])
// Param, FieldDesc:
// name: string,
// type: TypeDesc
// Return:
// value: Expr
// FuncDecl:
// name: string,
// params: [Param]
// return_type: TypeDesc
// FuncDef: FuncDecl,
// body: Block
// FuncCall:
// name: string,
// args: Block
// Scope:
// parent: Option<Scope>,
// vars: Map<string, TypeDesc>
// Expr:
// value:
// Literal(Literal),
// Assign(Assign),
// Binary(Binary),
// Block(Block),
// If(If),
// Loop(Loop)
// TypeDesc(TypeDesc),
// Param(Param),
// FuncReturn(Expr),
// FuncDecl(FuncDecl),
// FuncDef(FuncDef),
// FuncCall(FuncCall),
// scope: Scope
// Literal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment