mirror of
https://git.sfja.dk/Mikkel/slige.git
synced 2025-01-18 19:36:32 +00:00
20 lines
582 B
TypeScript
20 lines
582 B
TypeScript
import { Checker } from "./Checker.ts";
|
|
import { Lexer } from "./Lexer.ts";
|
|
import { Lowerer } from "./Lowerer.ts";
|
|
import { Parser } from "./Parser.ts";
|
|
import { Resolver } from "./Resolver.ts";
|
|
|
|
const text = await Deno.readTextFile("example.slg");
|
|
|
|
const lexer = new Lexer(text);
|
|
|
|
const parser = new Parser(lexer);
|
|
const ast = parser.parseStmts();
|
|
new Resolver().resolve(ast);
|
|
new Checker().check(ast);
|
|
// console.log(JSON.stringify(ast, null, 4))
|
|
const lowerer = new Lowerer();
|
|
lowerer.lower(ast);
|
|
const program = lowerer.finish();
|
|
console.log(JSON.stringify(program, null, 4));
|