slige/compiler/main.ts
2024-12-10 10:39:12 +01:00

22 lines
659 B
TypeScript

import { Checker } from "./Checker.ts";
import { Lexer } from "./Lexer.ts";
import { Parser } from "./Parser.ts";
import { Resolver } from "./Resolver.ts";
const text = await Deno.readTextFile("example.slg");
// const text = await Deno.readTextFile("example.slg");
const lexer = new Lexer(text);
// while (token !== null) {
// const value = token.identValue ?? token.intValue ?? token.stringValue ?? "";
// console.log(`${token.type}\t${value}`)
// token = lexer.next();
// }
const parser = new Parser(lexer);
const ast = parser.parseStmts();
new Resolver().resolve(ast);
new Checker().check(ast);
// console.log(JSON.stringify(ast, null, 4))