mirror of
https://git.sfja.dk/Mikkel/slige.git
synced 2025-01-18 19:16:35 +00:00
20 lines
592 B
TypeScript
20 lines
592 B
TypeScript
import { Lexer } from "./Lexer.ts";
|
|
import { Parser } from "./Parser.ts";
|
|
import { Resolver } from "./Syms.ts";
|
|
|
|
const text = await Deno.readTextFile("example-no-types.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)
|
|
console.log(JSON.stringify(ast, null, 4))
|