slige/compiler/main.ts
2024-11-20 15:43:42 +01:00

18 lines
531 B
TypeScript

import { Lexer } from "./Lexer.ts";
import { Parser } from "./Parser.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 result = parser.parseStmts()
console.log(JSON.stringify(result, null, 4))