slige/compiler/main.ts

22 lines
659 B
TypeScript
Raw Normal View History

2024-12-09 12:57:48 +00:00
import { Checker } from "./Checker.ts";
2024-11-04 13:54:55 +00:00
import { Lexer } from "./Lexer.ts";
2024-11-18 09:21:30 +00:00
import { Parser } from "./Parser.ts";
2024-12-10 09:39:12 +00:00
import { Resolver } from "./Resolver.ts";
2024-11-04 13:54:55 +00:00
2024-12-09 12:57:48 +00:00
const text = await Deno.readTextFile("example.slg");
2024-11-21 13:38:33 +00:00
// const text = await Deno.readTextFile("example.slg");
2024-11-04 13:54:55 +00:00
const lexer = new Lexer(text);
2024-11-20 14:41:20 +00:00
// while (token !== null) {
// const value = token.identValue ?? token.intValue ?? token.stringValue ?? "";
// console.log(`${token.type}\t${value}`)
// token = lexer.next();
// }
2024-12-10 09:39:12 +00:00
const parser = new Parser(lexer);
const ast = parser.parseStmts();
new Resolver().resolve(ast);
new Checker().check(ast);
2024-12-09 12:57:48 +00:00
// console.log(JSON.stringify(ast, null, 4))