transpiler (for future reference)

This commit is contained in:
Felix Roos 2024-05-17 23:09:43 +02:00
parent 2499c4057c
commit 3b4ae44fb3
2 changed files with 58 additions and 4 deletions

View file

@ -52,6 +52,9 @@ function curry(patterns, body, scope, ops) {
export function run(node, scope, ops = {}) {
let runInScope = (node, scp = scope) => run(node, scp, ops);
//console.log("node", node.type, node.text);
if (ops[node.type]) {
return ops[node.type](node);
}
switch (node.type) {
case 'ERROR':
throw new Error(`invalid syntax: "${node.text}"`);