A "high-level" language for the Gameboy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

44 lines
696 B

export type Program = Array<Decl | Stmt>
// Declarations
export type Decl = VarDecl
export type VarDecl = ADecl<"var", {
type: Type,
}>
type ADecl<Ty, Args> = {
type: "decl",
decl_type: Ty,
attrs: Array<Attr>,
name: string,
args: Args,
}
// Statements
export type Stmt = AssignStmt
export type AssignStmt = AStmt<"assign", {
name: string,
expr: Expr,
}>
type AStmt<Ty, Args> = {
type: "stmt",
stmt_type: Ty,
args: Args,
}
// Expressions
export type Expr = number
// Attributes
export type Attr = {
name: string,
args: Array<string | number>,
}
// Types
export type Type = PrimitiveType
export type PrimitiveType = "s8" | "u8" | "u16"