This commit is contained in:
nora 2023-07-23 14:02:53 +02:00
parent 91b183c002
commit 4e95bc05a3
9 changed files with 640 additions and 132 deletions

View file

@ -1,18 +1,30 @@
import { withErrorHandler } from "./error";
import { tokenize } from "./lexer";
import { parse } from "./parser";
import { printAst } from "./printer";
const input = `
function hello() {}
function main() = (
print("Hello, world!");
"uwu";
);
`;
function main() {
withErrorHandler(input, () => {
const tokens = tokenize(input);
console.log("-----TOKENS---");
console.log(tokens);
const ast = parse(tokens);
console.log(ast);
console.log("-----AST------");
console.dir(ast, { depth: 10 });
const printed = printAst(ast);
console.log("-----AST pretty------");
console.log(printed);
});
}