2024-12-09 13:57:48 +01:00
|
|
|
import { Checker } from "./Checker.ts";
|
2024-11-04 14:54:55 +01:00
|
|
|
import { Lexer } from "./Lexer.ts";
|
2024-12-10 14:36:41 +01:00
|
|
|
import { Lowerer } from "./Lowerer.ts";
|
2024-11-18 10:21:30 +01:00
|
|
|
import { Parser } from "./Parser.ts";
|
2024-12-10 10:39:12 +01:00
|
|
|
import { Resolver } from "./Resolver.ts";
|
2024-11-04 14:54:55 +01:00
|
|
|
|
2024-12-09 13:57:48 +01:00
|
|
|
const text = await Deno.readTextFile("example.slg");
|
2024-11-04 14:54:55 +01:00
|
|
|
|
|
|
|
const lexer = new Lexer(text);
|
2024-11-20 15:41:20 +01:00
|
|
|
|
2024-12-10 10:39:12 +01:00
|
|
|
const parser = new Parser(lexer);
|
|
|
|
const ast = parser.parseStmts();
|
|
|
|
new Resolver().resolve(ast);
|
|
|
|
new Checker().check(ast);
|
2024-12-09 13:57:48 +01:00
|
|
|
// console.log(JSON.stringify(ast, null, 4))
|
2024-12-10 14:36:41 +01:00
|
|
|
const lowerer = new Lowerer();
|
|
|
|
lowerer.lower(ast);
|
|
|
|
const program = lowerer.finish();
|
|
|
|
console.log(JSON.stringify(program, null, 4));
|