slige/compiler/main.ts

18 lines
532 B
TypeScript
Raw Normal View History

2024-11-04 14:54:55 +01:00
import { Lexer } from "./Lexer.ts";
2024-11-18 10:21:30 +01:00
import { Parser } from "./Parser.ts";
2024-11-04 14:54:55 +01:00
2024-11-21 14:38:33 +01:00
const text = await Deno.readTextFile("example-no-types.slg");
// 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
// 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))