slige/compiler/ast/ast.ts
2025-01-23 10:28:48 +01:00

27 lines
437 B
TypeScript

import { Span } from "../diagnostics.ts";
export type File = {
stmts: Stmt[];
};
export type Stmt = {
id: number;
kind: StmtKind;
span: Span;
};
export type StmtKind =
| { tag: "error" }
| { tag: "mod_block" } & ModBlockStmt
| { tag: "mod_file" } & ModFileStmt;
export type ModBlockStmt = {
ident: string;
stmts: Stmt[];
};
export type ModFileStmt = {
ident: string;
filePath: string;
};