From f17f098d20dc2249149dd4432d8f62e2477c36a0 Mon Sep 17 00:00:00 2001 From: sfja Date: Thu, 25 Sep 2025 15:59:06 +0200 Subject: [PATCH] use relative imports --- compile.phi | 11 +- compiler/emit_js.phi | 10 +- compiler/parse.phi | 2 +- compiler/syms.phi | 2 +- stage2.js | 1510 +++++++++++++++++++++--------------------- 5 files changed, 773 insertions(+), 762 deletions(-) diff --git a/compile.phi b/compile.phi index d17fe9c..d85b72a 100644 --- a/compile.phi +++ b/compile.phi @@ -1,6 +1,6 @@ -(import "stdlib.phi" (slice contains indent)) -(import "compiler/parse.phi" (Parser tokenize)) -(import "compiler/emit_js.phi" (JsEmitter)) +(import "./stdlib.phi" (slice contains indent)) +(import "./compiler/parse.phi" (Parser tokenize)) +(import "./compiler/emit_js.phi" (JsEmitter)) (fn print_expr (expr depth) (do (let (ty line value) expr) @@ -15,7 +15,10 @@ )) )) -(let (input_filename output_filename) (get_args)) +(let (input_filename_rel output_filename_rel) (get_args)) + +(let input_filename (fs_resolve (fs_cwd) input_filename_rel)) +(let output_filename (fs_resolve (fs_cwd) output_filename_rel)) (println "compiling '%'..." input_filename) (let text (read_text_file input_filename)) diff --git a/compiler/emit_js.phi b/compiler/emit_js.phi index e1ab8c5..972189b 100644 --- a/compiler/emit_js.phi +++ b/compiler/emit_js.phi @@ -1,10 +1,10 @@ -(import "stdlib.phi" ( +(import "../stdlib.phi" ( slice contains list_push list_pop list_contains map map_has map_get map_set )) -(import "compiler/parse.phi" (Parser tokenize)) -(import "compiler/syms.phi" (Syms)) +(import "./parse.phi" (Parser tokenize)) +(import "./syms.phi" (Syms)) (fn JsEmitter (ast initial_filename) (do (let output (list)) @@ -139,7 +139,9 @@ (panic "illegal function on line %" line) )) (if (== id "import") (do - (let (_ (_ _ inner_filename) (_ _ idents)) s) + (let (_ (_ _ inner_filename_rel) (_ _ idents)) s) + + (let inner_filename (fs_resolve (fs_dirname filename) inner_filename_rel)) (if (list_contains import_stack inner_filename) (do (panic "circular dependendy: '%' imports '%'" filename inner_filename) diff --git a/compiler/parse.phi b/compiler/parse.phi index e470b0f..c16b590 100644 --- a/compiler/parse.phi +++ b/compiler/parse.phi @@ -1,4 +1,4 @@ -(import "stdlib.phi" (slice slice_eq contains)) +(import "../stdlib.phi" (slice slice_eq contains)) (fn Parser (tokens) (do (let i 0) diff --git a/compiler/syms.phi b/compiler/syms.phi index 3ca77ed..b6a7a68 100644 --- a/compiler/syms.phi +++ b/compiler/syms.phi @@ -1,4 +1,4 @@ -(import "stdlib.phi" (indent map map_has map_get map_set)) +(import "../stdlib.phi" (indent map map_has map_get map_set)) (fn Syms () (do (let syms (list null (map))) diff --git a/stage2.js b/stage2.js index ebc3b4c..0ccdd5e 100644 --- a/stage2.js +++ b/stage2.js @@ -1,21 +1,21 @@ #!/usr/bin/env node import { Runtime } from "./runtime.js"; -const runtime = new Runtime("compile.phi"); -// === emitting file compile.phi === -// === emitting file stdlib.phi === -runtime.setFile("stdlib.phi"); +const runtime = new Runtime("/home/simone/Workspace/phi-lang/compile.phi"); +// === emitting file /home/simone/Workspace/phi-lang/compile.phi === +// === emitting file /home/simone/Workspace/phi-lang/stdlib.phi === +runtime.setFile("/home/simone/Workspace/phi-lang/stdlib.phi"); function _slice37(_list48, _idx49) { -runtime.pushCall("slice", "stdlib.phi"); -const r_0 = (runtime.info("stdlib.phi", 3), ((...args) => runtime.builtinLen(...args))(_list48)); +runtime.pushCall("slice", "/home/simone/Workspace/phi-lang/stdlib.phi"); +const r_0 = (runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 3), ((...args) => runtime.builtinLen(...args))(_list48)); let _list_len50 = r_0; const r_1 = ({ type: "list", values: [] }); let _elems51 = r_1; const r_2 = _idx49; let _i52 = r_2; while (true) { -if (runtime.truthy((runtime.info("stdlib.phi", 7), runtime.opGte(_i52, _list_len50)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 7), runtime.opGte(_i52, _list_len50)))) { break}; -(runtime.info("stdlib.phi", 8), ((...args) => runtime.builtinPush(...args))(_elems51, (runtime.info("stdlib.phi", 8), ((...args) => runtime.builtinAt(...args))(_list48, _i52)))); +(runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 8), ((...args) => runtime.builtinPush(...args))(_elems51, (runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 8), ((...args) => runtime.builtinAt(...args))(_list48, _i52)))); (_i52 = runtime.opAdd(_i52, ({ type: "int", value: 1 }))); }; runtime.popCall(); @@ -25,21 +25,21 @@ runtime.popCall(); return { type: "null" }; }; function _slice_eq38(_str53, _slice_idx54, _substr55) { -runtime.pushCall("slice_eq", "stdlib.phi"); -const r_3 = (runtime.info("stdlib.phi", 15), ((...args) => runtime.builtinLen(...args))(_str53)); +runtime.pushCall("slice_eq", "/home/simone/Workspace/phi-lang/stdlib.phi"); +const r_3 = (runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 15), ((...args) => runtime.builtinLen(...args))(_str53)); let _str_len56 = r_3; -const r_4 = (runtime.info("stdlib.phi", 16), ((...args) => runtime.builtinLen(...args))(_substr55)); +const r_4 = (runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 16), ((...args) => runtime.builtinLen(...args))(_substr55)); let _substr_len57 = r_4; const r_5 = ({ type: "int", value: 0 }); let _i58 = r_5; while (true) { -if (runtime.truthy((runtime.info("stdlib.phi", 19), runtime.opGte(_i58, _substr_len57)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 19), runtime.opGte(_i58, _substr_len57)))) { runtime.popCall(); return ({ type: "bool", value: true })}; -if (runtime.truthy((runtime.info("stdlib.phi", 21), runtime.opGte((runtime.info("stdlib.phi", 21), runtime.opAdd(_slice_idx54, _i58)), _str_len56)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 21), runtime.opGte((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 21), runtime.opAdd(_slice_idx54, _i58)), _str_len56)))) { runtime.popCall(); return ({ type: "bool", value: false })}; -if (runtime.truthy((runtime.info("stdlib.phi", 23), runtime.opNe((runtime.info("stdlib.phi", 23), ((...args) => runtime.builtinAt(...args))(_str53, (runtime.info("stdlib.phi", 23), runtime.opAdd(_slice_idx54, _i58)))), (runtime.info("stdlib.phi", 23), ((...args) => runtime.builtinAt(...args))(_substr55, _i58)))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 23), runtime.opNe((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 23), ((...args) => runtime.builtinAt(...args))(_str53, (runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 23), runtime.opAdd(_slice_idx54, _i58)))), (runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 23), ((...args) => runtime.builtinAt(...args))(_substr55, _i58)))))) { runtime.popCall(); return ({ type: "bool", value: false })}; (_i58 = runtime.opAdd(_i58, ({ type: "int", value: 1 }))); @@ -51,15 +51,15 @@ runtime.popCall(); return { type: "null" }; }; function _contains39(_text59, _ch60) { -runtime.pushCall("contains", "stdlib.phi"); -const r_6 = (runtime.info("stdlib.phi", 32), ((...args) => runtime.builtinLen(...args))(_text59)); +runtime.pushCall("contains", "/home/simone/Workspace/phi-lang/stdlib.phi"); +const r_6 = (runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 32), ((...args) => runtime.builtinLen(...args))(_text59)); let _text_len61 = r_6; const r_7 = ({ type: "int", value: 0 }); let _i62 = r_7; while (true) { -if (runtime.truthy((runtime.info("stdlib.phi", 35), runtime.opGte(_i62, _text_len61)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 35), runtime.opGte(_i62, _text_len61)))) { break}; -if (runtime.truthy((runtime.info("stdlib.phi", 36), runtime.opEq((runtime.info("stdlib.phi", 36), ((...args) => runtime.builtinAt(...args))(_text59, _i62)), _ch60)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 36), runtime.opEq((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 36), ((...args) => runtime.builtinAt(...args))(_text59, _i62)), _ch60)))) { runtime.popCall(); return ({ type: "bool", value: true }); }; @@ -72,13 +72,13 @@ runtime.popCall(); return { type: "null" }; }; function _indent40(_depth63) { -runtime.pushCall("indent", "stdlib.phi"); +runtime.pushCall("indent", "/home/simone/Workspace/phi-lang/stdlib.phi"); const r_8 = ({ type: "string", value: "" }); let _space64 = r_8; const r_9 = ({ type: "int", value: 0 }); let _i65 = r_9; while (true) { -if (runtime.truthy((runtime.info("stdlib.phi", 48), runtime.opGte(_i65, _depth63)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 48), runtime.opGte(_i65, _depth63)))) { break}; (_space64 = runtime.opAdd(_space64, ({ type: "string", value: " " }))); (_i65 = runtime.opAdd(_i65, ({ type: "int", value: 1 }))); @@ -90,37 +90,37 @@ runtime.popCall(); return { type: "null" }; }; function _list_push41(_list_66, _value67) { -runtime.pushCall("list_push", "stdlib.phi"); -const r_10 = (runtime.info("stdlib.phi", 56), ((...args) => runtime.builtinLen(...args))(_list_66)); +runtime.pushCall("list_push", "/home/simone/Workspace/phi-lang/stdlib.phi"); +const r_10 = (runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 56), ((...args) => runtime.builtinLen(...args))(_list_66)); let _list_len68 = r_10; const r_11 = ({ type: "int", value: 0 }); let _i69 = r_11; while (true) { -if (runtime.truthy((runtime.info("stdlib.phi", 59), runtime.opGte(_i69, _list_len68)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 59), runtime.opGte(_i69, _list_len68)))) { break}; -if (runtime.truthy((runtime.info("stdlib.phi", 60), runtime.opEq((runtime.info("stdlib.phi", 60), ((...args) => runtime.builtinAt(...args))(_list_66, _i69)), ({ type: "null" }))))) { -(runtime.info("stdlib.phi", 61), ((...args) => runtime.builtinSet(...args))(_list_66, _i69, _value67)); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 60), runtime.opEq((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 60), ((...args) => runtime.builtinAt(...args))(_list_66, _i69)), ({ type: "null" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 61), ((...args) => runtime.builtinSet(...args))(_list_66, _i69, _value67)); runtime.popCall(); return { type: "null" }; }; (_i69 = runtime.opAdd(_i69, ({ type: "int", value: 1 }))); }; -(runtime.info("stdlib.phi", 66), ((...args) => runtime.builtinPush(...args))(_list_66, _value67)); +(runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 66), ((...args) => runtime.builtinPush(...args))(_list_66, _value67)); ; runtime.popCall(); return { type: "null" }; }; function _list_pop42(_list_70) { -runtime.pushCall("list_pop", "stdlib.phi"); -const r_12 = (runtime.info("stdlib.phi", 70), runtime.opSub((runtime.info("stdlib.phi", 70), ((...args) => runtime.builtinLen(...args))(_list_70)), ({ type: "int", value: 1 }))); +runtime.pushCall("list_pop", "/home/simone/Workspace/phi-lang/stdlib.phi"); +const r_12 = (runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 70), runtime.opSub((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 70), ((...args) => runtime.builtinLen(...args))(_list_70)), ({ type: "int", value: 1 }))); let _i71 = r_12; while (true) { -if (runtime.truthy((runtime.info("stdlib.phi", 72), runtime.opLt(_i71, ({ type: "int", value: 0 }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 72), runtime.opLt(_i71, ({ type: "int", value: 0 }))))) { break}; -const r_13 = (runtime.info("stdlib.phi", 73), ((...args) => runtime.builtinAt(...args))(_list_70, _i71)); +const r_13 = (runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 73), ((...args) => runtime.builtinAt(...args))(_list_70, _i71)); let _value72 = r_13; -if (runtime.truthy((runtime.info("stdlib.phi", 74), runtime.opNe(_value72, ({ type: "null" }))))) { -(runtime.info("stdlib.phi", 75), ((...args) => runtime.builtinSet(...args))(_list_70, _i71, ({ type: "null" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 74), runtime.opNe(_value72, ({ type: "null" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 75), ((...args) => runtime.builtinSet(...args))(_list_70, _i71, ({ type: "null" }))); runtime.popCall(); return _value72; }; @@ -133,10 +133,10 @@ runtime.popCall(); return { type: "null" }; }; function _list_contains43(_list_73, _value74) { -runtime.pushCall("list_contains", "stdlib.phi"); +runtime.pushCall("list_contains", "/home/simone/Workspace/phi-lang/stdlib.phi"); for (const r_14 of _list_73.values) {; let _elem75 = r_14; -if (runtime.truthy((runtime.info("stdlib.phi", 85), runtime.opEq(_elem75, _value74)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 85), runtime.opEq(_elem75, _value74)))) { runtime.popCall(); return ({ type: "bool", value: true }); }; @@ -148,7 +148,7 @@ runtime.popCall(); return { type: "null" }; }; function _map44() { -runtime.pushCall("map", "stdlib.phi"); +runtime.pushCall("map", "/home/simone/Workspace/phi-lang/stdlib.phi"); runtime.popCall(); return ({ type: "list", values: [] }); ; @@ -156,12 +156,12 @@ runtime.popCall(); return { type: "null" }; }; function _map_has45(_map76, _key77) { -runtime.pushCall("map_has", "stdlib.phi"); +runtime.pushCall("map_has", "/home/simone/Workspace/phi-lang/stdlib.phi"); for (const r_15 of _map76.values) {; const r_16 = r_15.values[0] ?? { type: "null"}; let _m_key78 = r_16; const r_17 = r_15.values[1] ?? { type: "null"}; -if (runtime.truthy((runtime.info("stdlib.phi", 98), runtime.opEq(_m_key78, _key77)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 98), runtime.opEq(_m_key78, _key77)))) { runtime.popCall(); return ({ type: "bool", value: true }); }; @@ -173,13 +173,13 @@ runtime.popCall(); return { type: "null" }; }; function _map_get46(_map79, _key80) { -runtime.pushCall("map_get", "stdlib.phi"); +runtime.pushCall("map_get", "/home/simone/Workspace/phi-lang/stdlib.phi"); for (const r_18 of _map79.values) {; const r_19 = r_18.values[0] ?? { type: "null"}; let _m_key81 = r_19; const r_20 = r_18.values[1] ?? { type: "null"}; let _value82 = r_20; -if (runtime.truthy((runtime.info("stdlib.phi", 107), runtime.opEq(_m_key81, _key80)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 107), runtime.opEq(_m_key81, _key80)))) { runtime.popCall(); return _value82; }; @@ -191,44 +191,44 @@ runtime.popCall(); return { type: "null" }; }; function _map_set47(_map83, _key84, _value85) { -runtime.pushCall("map_set", "stdlib.phi"); +runtime.pushCall("map_set", "/home/simone/Workspace/phi-lang/stdlib.phi"); for (const r_21 of _map83.values) {; let _entry86 = r_21; const r_22 = _entry86; const r_23 = r_22.values[0] ?? { type: "null"}; let _entry_key87 = r_23; const r_24 = r_22.values[1] ?? { type: "null"}; -if (runtime.truthy((runtime.info("stdlib.phi", 117), runtime.opEq(_entry_key87, _key84)))) { -(runtime.info("stdlib.phi", 118), ((...args) => runtime.builtinSet(...args))(_entry86, ({ type: "int", value: 1 }), _value85)); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 117), runtime.opEq(_entry_key87, _key84)))) { +(runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 118), ((...args) => runtime.builtinSet(...args))(_entry86, ({ type: "int", value: 1 }), _value85)); runtime.popCall(); return { type: "null" }; }; }; -(runtime.info("stdlib.phi", 122), ((...args) => runtime.builtinPush(...args))(_map83, ({ type: "list", values: [_key84, _value85] }))); +(runtime.info("/home/simone/Workspace/phi-lang/stdlib.phi", 122), ((...args) => runtime.builtinPush(...args))(_map83, ({ type: "list", values: [_key84, _value85] }))); ; runtime.popCall(); return { type: "null" }; }; -// === resuming file compile.phi === -runtime.setFile("compile.phi"); -// === emitting file compiler/parse.phi === -runtime.setFile("compiler/parse.phi"); +// === resuming file /home/simone/Workspace/phi-lang/compile.phi === +runtime.setFile("/home/simone/Workspace/phi-lang/compile.phi"); +// === emitting file /home/simone/Workspace/phi-lang/compiler/parse.phi === +runtime.setFile("/home/simone/Workspace/phi-lang/compiler/parse.phi"); ; function _Parser106(_tokens108) { -runtime.pushCall("Parser", "compiler/parse.phi"); +runtime.pushCall("Parser", "/home/simone/Workspace/phi-lang/compiler/parse.phi"); const r_25 = ({ type: "int", value: 0 }); let _i115 = r_25; -const r_26 = (runtime.info("compiler/parse.phi", 5), ((...args) => runtime.builtinAt(...args))(_tokens108, _i115)); +const r_26 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 5), ((...args) => runtime.builtinAt(...args))(_tokens108, _i115)); let _tok116 = r_26; function _parse109() { -runtime.pushCall("parse", "compiler/parse.phi"); +runtime.pushCall("parse", "/home/simone/Workspace/phi-lang/compiler/parse.phi"); const r_27 = ({ type: "list", values: [] }); let _exprs117 = r_27; while (true) { -if (runtime.truthy((runtime.info("compiler/parse.phi", 10), _done114()))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 10), _done114()))) { break}; -(runtime.info("compiler/parse.phi", 11), ((...args) => runtime.builtinPush(...args))(_exprs117, (runtime.info("compiler/parse.phi", 11), _parse_expr110()))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 11), ((...args) => runtime.builtinPush(...args))(_exprs117, (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 11), _parse_expr110()))); }; runtime.popCall(); return _exprs117; @@ -237,7 +237,7 @@ runtime.popCall(); return { type: "null" }; }; function _parse_expr110() { -runtime.pushCall("parse_expr", "compiler/parse.phi"); +runtime.pushCall("parse_expr", "/home/simone/Workspace/phi-lang/compiler/parse.phi"); const r_28 = _tok116; const r_29 = r_28.values[0] ?? { type: "null"}; let _ty118 = r_29; @@ -245,44 +245,44 @@ const r_30 = r_28.values[1] ?? { type: "null"}; let _line119 = r_30; const r_31 = r_28.values[2] ?? { type: "null"}; let _value120 = r_31; -if (runtime.truthy((runtime.info("compiler/parse.phi", 18), _eat111(({ type: "string", value: "(" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 18), _eat111(({ type: "string", value: "(" }))))) { const r_32 = ({ type: "list", values: [] }); let _values121 = r_32; while (true) { -if (runtime.truthy((runtime.info("compiler/parse.phi", 21), _test113(({ type: "string", value: ")" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 21), _test113(({ type: "string", value: ")" }))))) { break}; -(runtime.info("compiler/parse.phi", 22), ((...args) => runtime.builtinPush(...args))(_values121, (runtime.info("compiler/parse.phi", 22), _parse_expr110()))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 22), ((...args) => runtime.builtinPush(...args))(_values121, (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 22), _parse_expr110()))); }; -if (runtime.truthy(runtime.opNot((runtime.info("compiler/parse.phi", 24), _eat111(({ type: "string", value: ")" })))))) { -(runtime.info("compiler/parse.phi", 25), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "expected ')' on line %" }), (runtime.info("compiler/parse.phi", 25), ((...args) => runtime.builtinAt(...args))(_tok116, ({ type: "int", value: 1 }))))); +if (runtime.truthy(runtime.opNot((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 24), _eat111(({ type: "string", value: ")" })))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 25), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "expected ')' on line %" }), (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 25), ((...args) => runtime.builtinAt(...args))(_tok116, ({ type: "int", value: 1 }))))); }; runtime.popCall(); return ({ type: "list", values: [({ type: "string", value: "list" }), _line119, _values121] }); } else { -if (runtime.truthy((runtime.info("compiler/parse.phi", 28), _eat111(({ type: "string", value: "string" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 28), _eat111(({ type: "string", value: "string" }))))) { runtime.popCall(); return ({ type: "list", values: [({ type: "string", value: "string" }), _line119, _value120] }); } else { -if (runtime.truthy((runtime.info("compiler/parse.phi", 30), _eat111(({ type: "string", value: "int" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 30), _eat111(({ type: "string", value: "int" }))))) { runtime.popCall(); -return ({ type: "list", values: [({ type: "string", value: "int" }), _line119, (runtime.info("compiler/parse.phi", 31), ((...args) => runtime.builtinStringToInt(...args))(_value120))] }); +return ({ type: "list", values: [({ type: "string", value: "int" }), _line119, (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 31), ((...args) => runtime.builtinStringToInt(...args))(_value120))] }); } else { -if (runtime.truthy((runtime.info("compiler/parse.phi", 32), _eat111(({ type: "string", value: "ident" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 32), _eat111(({ type: "string", value: "ident" }))))) { runtime.popCall(); return ({ type: "list", values: [({ type: "string", value: "ident" }), _line119, _value120] }); } else { -(runtime.info("compiler/parse.phi", 35), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "expected expression, got '%' on line %" }), _ty118, _line119)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 35), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "expected expression, got '%' on line %" }), _ty118, _line119)); }}}}; ; runtime.popCall(); return { type: "null" }; }; function _eat111(_pat122) { -runtime.pushCall("eat", "compiler/parse.phi"); -if (runtime.truthy(runtime.opNot((runtime.info("compiler/parse.phi", 40), _test113(_pat122))))) { +runtime.pushCall("eat", "/home/simone/Workspace/phi-lang/compiler/parse.phi"); +if (runtime.truthy(runtime.opNot((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 40), _test113(_pat122))))) { runtime.popCall(); return ({ type: "bool", value: false })}; -(runtime.info("compiler/parse.phi", 41), _step112()); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 41), _step112()); runtime.popCall(); return ({ type: "bool", value: true }); ; @@ -290,10 +290,10 @@ runtime.popCall(); return { type: "null" }; }; function _step112() { -runtime.pushCall("step", "compiler/parse.phi"); +runtime.pushCall("step", "/home/simone/Workspace/phi-lang/compiler/parse.phi"); (_i115 = runtime.opAdd(_i115, ({ type: "int", value: 1 }))); -if (runtime.truthy(runtime.opNot((runtime.info("compiler/parse.phi", 47), _done114())))) { -const r_33 = (runtime.info("compiler/parse.phi", 48), ((...args) => runtime.builtinAt(...args))(_tokens108, _i115)); +if (runtime.truthy(runtime.opNot((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 47), _done114())))) { +const r_33 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 48), ((...args) => runtime.builtinAt(...args))(_tokens108, _i115)); let _new_tok123 = r_33; (_tok116 = _new_tok123); }; @@ -302,23 +302,23 @@ runtime.popCall(); return { type: "null" }; }; function _test113(_pat124) { -runtime.pushCall("test", "compiler/parse.phi"); -if (runtime.truthy((runtime.info("compiler/parse.phi", 54), _done114()))) { +runtime.pushCall("test", "/home/simone/Workspace/phi-lang/compiler/parse.phi"); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 54), _done114()))) { runtime.popCall(); return ({ type: "bool", value: false })}; const r_34 = _tok116; const r_35 = r_34.values[0] ?? { type: "null"}; let _ty125 = r_35; runtime.popCall(); -return (runtime.info("compiler/parse.phi", 56), runtime.opEq(_pat124, _ty125)); +return (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 56), runtime.opEq(_pat124, _ty125)); ; runtime.popCall(); return { type: "null" }; }; function _done114() { -runtime.pushCall("done", "compiler/parse.phi"); +runtime.pushCall("done", "/home/simone/Workspace/phi-lang/compiler/parse.phi"); runtime.popCall(); -return (runtime.info("compiler/parse.phi", 60), runtime.opGte(_i115, (runtime.info("compiler/parse.phi", 60), ((...args) => runtime.builtinLen(...args))(_tokens108)))); +return (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 60), runtime.opGte(_i115, (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 60), ((...args) => runtime.builtinLen(...args))(_tokens108)))); ; runtime.popCall(); return { type: "null" }; @@ -330,8 +330,8 @@ runtime.popCall(); return { type: "null" }; }; function _tokenize107(_text126) { -runtime.pushCall("tokenize", "compiler/parse.phi"); -const r_36 = (runtime.info("compiler/parse.phi", 67), ((...args) => runtime.builtinLen(...args))(_text126)); +runtime.pushCall("tokenize", "/home/simone/Workspace/phi-lang/compiler/parse.phi"); +const r_36 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 67), ((...args) => runtime.builtinLen(...args))(_text126)); let _text_len127 = r_36; const r_37 = ({ type: "list", values: [] }); let _tokens128 = r_37; @@ -339,56 +339,56 @@ const r_38 = ({ type: "int", value: 0 }); let _i129 = r_38; const r_39 = ({ type: "int", value: 1 }); let _line130 = r_39; -const r_40 = (runtime.info("compiler/parse.phi", 73), runtime.opAdd(({ type: "string", value: "abcdefghijklmnopqrstuvwxyz" }), ({ type: "string", value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890+-*/%&|=?!<>'_" }))); +const r_40 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 73), runtime.opAdd(({ type: "string", value: "abcdefghijklmnopqrstuvwxyz" }), ({ type: "string", value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890+-*/%&|=?!<>'_" }))); let _ident_chars131 = r_40; while (true) { -if (runtime.truthy((runtime.info("compiler/parse.phi", 77), runtime.opGte(_i129, _text_len127)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 77), runtime.opGte(_i129, _text_len127)))) { break}; -const r_41 = (runtime.info("compiler/parse.phi", 79), ((...args) => runtime.builtinAt(...args))(_text126, _i129)); +const r_41 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 79), ((...args) => runtime.builtinAt(...args))(_text126, _i129)); let _ch132 = r_41; -if (runtime.truthy((runtime.info("compiler/parse.phi", 81), _contains39(({ type: "string", value: " \t\r\n" }), _ch132)))) { -if (runtime.truthy((runtime.info("compiler/parse.phi", 82), runtime.opEq(_ch132, ({ type: "string", value: "\n" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 81), _contains39(({ type: "string", value: " \t\r\n" }), _ch132)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 82), runtime.opEq(_ch132, ({ type: "string", value: "\n" }))))) { (_line130 = runtime.opAdd(_line130, ({ type: "int", value: 1 }))); }; (_i129 = runtime.opAdd(_i129, ({ type: "int", value: 1 }))); } else { -if (runtime.truthy((runtime.info("compiler/parse.phi", 86), _slice_eq38(_text126, _i129, ({ type: "string", value: "//" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 86), _slice_eq38(_text126, _i129, ({ type: "string", value: "//" }))))) { while (true) { -if (runtime.truthy((runtime.info("compiler/parse.phi", 88), { type: "bool", value: runtime.truthy((runtime.info("compiler/parse.phi", 88), runtime.opGte(_i129, _text_len127))) || runtime.truthy((runtime.info("compiler/parse.phi", 88), runtime.opEq((runtime.info("compiler/parse.phi", 88), ((...args) => runtime.builtinAt(...args))(_text126, _i129)), ({ type: "string", value: "\n" })))) }))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 88), { type: "bool", value: runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 88), runtime.opGte(_i129, _text_len127))) || runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 88), runtime.opEq((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 88), ((...args) => runtime.builtinAt(...args))(_text126, _i129)), ({ type: "string", value: "\n" })))) }))) { break; }; (_i129 = runtime.opAdd(_i129, ({ type: "int", value: 1 }))); }; } else { -if (runtime.truthy((runtime.info("compiler/parse.phi", 93), _contains39(({ type: "string", value: "()" }), _ch132)))) { -(runtime.info("compiler/parse.phi", 94), ((...args) => runtime.builtinPush(...args))(_tokens128, ({ type: "list", values: [_ch132, _line130] }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 93), _contains39(({ type: "string", value: "()" }), _ch132)))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 94), ((...args) => runtime.builtinPush(...args))(_tokens128, ({ type: "list", values: [_ch132, _line130] }))); (_i129 = runtime.opAdd(_i129, ({ type: "int", value: 1 }))); } else { -if (runtime.truthy((runtime.info("compiler/parse.phi", 96), runtime.opEq(_ch132, ({ type: "string", value: "\"" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 96), runtime.opEq(_ch132, ({ type: "string", value: "\"" }))))) { const r_42 = ({ type: "string", value: "" }); let _value133 = r_42; (_i129 = runtime.opAdd(_i129, ({ type: "int", value: 1 }))); -(_ch132 = (runtime.info("compiler/parse.phi", 99), ((...args) => runtime.builtinAt(...args))(_text126, _i129))); +(_ch132 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 99), ((...args) => runtime.builtinAt(...args))(_text126, _i129))); while (true) { -if (runtime.truthy((runtime.info("compiler/parse.phi", 101), { type: "bool", value: runtime.truthy((runtime.info("compiler/parse.phi", 101), runtime.opGte(_i129, _text_len127))) || runtime.truthy((runtime.info("compiler/parse.phi", 101), runtime.opEq(_ch132, ({ type: "string", value: "\"" })))) }))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 101), { type: "bool", value: runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 101), runtime.opGte(_i129, _text_len127))) || runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 101), runtime.opEq(_ch132, ({ type: "string", value: "\"" })))) }))) { break; }; -if (runtime.truthy((runtime.info("compiler/parse.phi", 104), runtime.opEq(_ch132, ({ type: "string", value: "\\" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 104), runtime.opEq(_ch132, ({ type: "string", value: "\\" }))))) { (_i129 = runtime.opAdd(_i129, ({ type: "int", value: 1 }))); -if (runtime.truthy((runtime.info("compiler/parse.phi", 106), runtime.opGte(_i129, _text_len127)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 106), runtime.opGte(_i129, _text_len127)))) { break; }; -(_ch132 = (runtime.info("compiler/parse.phi", 109), ((...args) => runtime.builtinAt(...args))(_text126, _i129))); -if (runtime.truthy((runtime.info("compiler/parse.phi", 110), runtime.opEq(_ch132, ({ type: "string", value: "t" }))))) { +(_ch132 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 109), ((...args) => runtime.builtinAt(...args))(_text126, _i129))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 110), runtime.opEq(_ch132, ({ type: "string", value: "t" }))))) { (_value133 = runtime.opAdd(_value133, ({ type: "string", value: "\t" }))); } else { -if (runtime.truthy((runtime.info("compiler/parse.phi", 112), runtime.opEq(_ch132, ({ type: "string", value: "r" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 112), runtime.opEq(_ch132, ({ type: "string", value: "r" }))))) { (_value133 = runtime.opAdd(_value133, ({ type: "string", value: "\r" }))); } else { -if (runtime.truthy((runtime.info("compiler/parse.phi", 114), runtime.opEq(_ch132, ({ type: "string", value: "n" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 114), runtime.opEq(_ch132, ({ type: "string", value: "n" }))))) { (_value133 = runtime.opAdd(_value133, ({ type: "string", value: "\n" }))); } else { -if (runtime.truthy((runtime.info("compiler/parse.phi", 116), runtime.opEq(_ch132, ({ type: "string", value: "0" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 116), runtime.opEq(_ch132, ({ type: "string", value: "0" }))))) { (_value133 = runtime.opAdd(_value133, ({ type: "string", value: "\n" }))); } else { (_value133 = runtime.opAdd(_value133, _ch132)); @@ -397,41 +397,41 @@ if (runtime.truthy((runtime.info("compiler/parse.phi", 116), runtime.opEq(_ch132 (_value133 = runtime.opAdd(_value133, _ch132)); }; (_i129 = runtime.opAdd(_i129, ({ type: "int", value: 1 }))); -(_ch132 = (runtime.info("compiler/parse.phi", 125), ((...args) => runtime.builtinAt(...args))(_text126, _i129))); +(_ch132 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 125), ((...args) => runtime.builtinAt(...args))(_text126, _i129))); }; -if (runtime.truthy((runtime.info("compiler/parse.phi", 127), { type: "bool", value: runtime.truthy((runtime.info("compiler/parse.phi", 127), runtime.opGte(_i129, _text_len127))) || runtime.truthy((runtime.info("compiler/parse.phi", 127), runtime.opNe(_ch132, ({ type: "string", value: "\"" })))) }))) { -(runtime.info("compiler/parse.phi", 128), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "expected '\"' on line %" }), _line130)); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 127), { type: "bool", value: runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 127), runtime.opGte(_i129, _text_len127))) || runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 127), runtime.opNe(_ch132, ({ type: "string", value: "\"" })))) }))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 128), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "expected '\"' on line %" }), _line130)); }; (_i129 = runtime.opAdd(_i129, ({ type: "int", value: 1 }))); -(runtime.info("compiler/parse.phi", 131), ((...args) => runtime.builtinPush(...args))(_tokens128, ({ type: "list", values: [({ type: "string", value: "string" }), _line130, _value133] }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 131), ((...args) => runtime.builtinPush(...args))(_tokens128, ({ type: "list", values: [({ type: "string", value: "string" }), _line130, _value133] }))); } else { -if (runtime.truthy((runtime.info("compiler/parse.phi", 132), _contains39(({ type: "string", value: "0123456789" }), _ch132)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 132), _contains39(({ type: "string", value: "0123456789" }), _ch132)))) { const r_43 = ({ type: "string", value: "" }); let _value134 = r_43; while (true) { -(_ch132 = (runtime.info("compiler/parse.phi", 135), ((...args) => runtime.builtinAt(...args))(_text126, _i129))); -if (runtime.truthy((runtime.info("compiler/parse.phi", 136), { type: "bool", value: runtime.truthy((runtime.info("compiler/parse.phi", 136), runtime.opGte(_i129, _text_len127))) || runtime.truthy(runtime.opNot((runtime.info("compiler/parse.phi", 136), _contains39(({ type: "string", value: "0123456789" }), _ch132)))) }))) { +(_ch132 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 135), ((...args) => runtime.builtinAt(...args))(_text126, _i129))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 136), { type: "bool", value: runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 136), runtime.opGte(_i129, _text_len127))) || runtime.truthy(runtime.opNot((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 136), _contains39(({ type: "string", value: "0123456789" }), _ch132)))) }))) { break; }; (_value134 = runtime.opAdd(_value134, _ch132)); (_i129 = runtime.opAdd(_i129, ({ type: "int", value: 1 }))); }; -(runtime.info("compiler/parse.phi", 142), ((...args) => runtime.builtinPush(...args))(_tokens128, ({ type: "list", values: [({ type: "string", value: "int" }), _line130, _value134] }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 142), ((...args) => runtime.builtinPush(...args))(_tokens128, ({ type: "list", values: [({ type: "string", value: "int" }), _line130, _value134] }))); } else { -if (runtime.truthy((runtime.info("compiler/parse.phi", 143), _contains39(_ident_chars131, _ch132)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 143), _contains39(_ident_chars131, _ch132)))) { const r_44 = ({ type: "string", value: "" }); let _value135 = r_44; while (true) { -(_ch132 = (runtime.info("compiler/parse.phi", 146), ((...args) => runtime.builtinAt(...args))(_text126, _i129))); -if (runtime.truthy((runtime.info("compiler/parse.phi", 147), { type: "bool", value: runtime.truthy((runtime.info("compiler/parse.phi", 147), runtime.opGte(_i129, _text_len127))) || runtime.truthy(runtime.opNot((runtime.info("compiler/parse.phi", 147), _contains39(_ident_chars131, _ch132)))) }))) { +(_ch132 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 146), ((...args) => runtime.builtinAt(...args))(_text126, _i129))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 147), { type: "bool", value: runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 147), runtime.opGte(_i129, _text_len127))) || runtime.truthy(runtime.opNot((runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 147), _contains39(_ident_chars131, _ch132)))) }))) { break; }; (_value135 = runtime.opAdd(_value135, _ch132)); (_i129 = runtime.opAdd(_i129, ({ type: "int", value: 1 }))); }; -(runtime.info("compiler/parse.phi", 153), ((...args) => runtime.builtinPush(...args))(_tokens128, ({ type: "list", values: [({ type: "string", value: "ident" }), _line130, _value135] }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 153), ((...args) => runtime.builtinPush(...args))(_tokens128, ({ type: "list", values: [({ type: "string", value: "ident" }), _line130, _value135] }))); } else { -(runtime.info("compiler/parse.phi", 155), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "illegal char '%'" }), _ch132)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/parse.phi", 155), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "illegal char '%'" }), _ch132)); (_i129 = runtime.opAdd(_i129, ({ type: "int", value: 1 }))); }}}}}}; }; @@ -442,28 +442,28 @@ runtime.popCall(); return { type: "null" }; }; -// === resuming file compile.phi === -runtime.setFile("compile.phi"); -// === emitting file compiler/emit_js.phi === -runtime.setFile("compiler/emit_js.phi"); +// === resuming file /home/simone/Workspace/phi-lang/compile.phi === +runtime.setFile("/home/simone/Workspace/phi-lang/compile.phi"); +// === emitting file /home/simone/Workspace/phi-lang/compiler/emit_js.phi === +runtime.setFile("/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); ; ; -// === emitting file compiler/syms.phi === -runtime.setFile("compiler/syms.phi"); +// === emitting file /home/simone/Workspace/phi-lang/compiler/syms.phi === +runtime.setFile("/home/simone/Workspace/phi-lang/compiler/syms.phi"); ; function _Syms175() { -runtime.pushCall("Syms", "compiler/syms.phi"); -const r_45 = ({ type: "list", values: [({ type: "null" }), (runtime.info("compiler/syms.phi", 4), _map44())] }); +runtime.pushCall("Syms", "/home/simone/Workspace/phi-lang/compiler/syms.phi"); +const r_45 = ({ type: "list", values: [({ type: "null" }), (runtime.info("/home/simone/Workspace/phi-lang/compiler/syms.phi", 4), _map44())] }); let _syms184 = r_45; function _enter_scope176() { -runtime.pushCall("enter_scope", "compiler/syms.phi"); -(_syms184 = ({ type: "list", values: [_syms184, (runtime.info("compiler/syms.phi", 7), _map44())] })); +runtime.pushCall("enter_scope", "/home/simone/Workspace/phi-lang/compiler/syms.phi"); +(_syms184 = ({ type: "list", values: [_syms184, (runtime.info("/home/simone/Workspace/phi-lang/compiler/syms.phi", 7), _map44())] })); ; runtime.popCall(); return { type: "null" }; }; function _leave_scope177() { -runtime.pushCall("leave_scope", "compiler/syms.phi"); +runtime.pushCall("leave_scope", "/home/simone/Workspace/phi-lang/compiler/syms.phi"); const r_46 = _syms184; const r_47 = r_46.values[0] ?? { type: "null"}; let _parent185 = r_47; @@ -474,30 +474,30 @@ runtime.popCall(); return { type: "null" }; }; function _define_sym178(_ident186, _sym187) { -runtime.pushCall("define_sym", "compiler/syms.phi"); +runtime.pushCall("define_sym", "/home/simone/Workspace/phi-lang/compiler/syms.phi"); const r_49 = _syms184; const r_50 = r_49.values[0] ?? { type: "null"}; const r_51 = r_49.values[1] ?? { type: "null"}; let _map188 = r_51; -(runtime.info("compiler/syms.phi", 17), _map_set47(_map188, _ident186, _sym187)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/syms.phi", 17), _map_set47(_map188, _ident186, _sym187)); ; runtime.popCall(); return { type: "null" }; }; function _find_sym179(_syms189, _ident190) { -runtime.pushCall("find_sym", "compiler/syms.phi"); +runtime.pushCall("find_sym", "/home/simone/Workspace/phi-lang/compiler/syms.phi"); const r_52 = _syms189; const r_53 = r_52.values[0] ?? { type: "null"}; let _parent191 = r_53; const r_54 = r_52.values[1] ?? { type: "null"}; let _map192 = r_54; -if (runtime.truthy((runtime.info("compiler/syms.phi", 22), _map_has45(_map192, _ident190)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/syms.phi", 22), _map_has45(_map192, _ident190)))) { runtime.popCall(); -return (runtime.info("compiler/syms.phi", 23), _map_get46(_map192, _ident190)); +return (runtime.info("/home/simone/Workspace/phi-lang/compiler/syms.phi", 23), _map_get46(_map192, _ident190)); }; -if (runtime.truthy((runtime.info("compiler/syms.phi", 25), runtime.opNe(_parent191, ({ type: "null" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/syms.phi", 25), runtime.opNe(_parent191, ({ type: "null" }))))) { runtime.popCall(); -return (runtime.info("compiler/syms.phi", 26), _find_sym179(_parent191, _ident190)); +return (runtime.info("/home/simone/Workspace/phi-lang/compiler/syms.phi", 26), _find_sym179(_parent191, _ident190)); }; runtime.popCall(); return ({ type: "null" }); @@ -506,15 +506,15 @@ runtime.popCall(); return { type: "null" }; }; function _get_sym180(_ident193) { -runtime.pushCall("get_sym", "compiler/syms.phi"); +runtime.pushCall("get_sym", "/home/simone/Workspace/phi-lang/compiler/syms.phi"); runtime.popCall(); -return (runtime.info("compiler/syms.phi", 32), _find_sym179(_syms184, _ident193)); +return (runtime.info("/home/simone/Workspace/phi-lang/compiler/syms.phi", 32), _find_sym179(_syms184, _ident193)); ; runtime.popCall(); return { type: "null" }; }; function _get_current_map181() { -runtime.pushCall("get_current_map", "compiler/syms.phi"); +runtime.pushCall("get_current_map", "/home/simone/Workspace/phi-lang/compiler/syms.phi"); const r_55 = _syms184; const r_56 = r_55.values[0] ?? { type: "null"}; const r_57 = r_55.values[1] ?? { type: "null"}; @@ -526,7 +526,7 @@ runtime.popCall(); return { type: "null" }; }; function _print_syms_node182(_syms195, _depth196) { -runtime.pushCall("print_syms_node", "compiler/syms.phi"); +runtime.pushCall("print_syms_node", "/home/simone/Workspace/phi-lang/compiler/syms.phi"); const r_58 = _syms195; const r_59 = r_58.values[0] ?? { type: "null"}; let _parent197 = r_59; @@ -537,18 +537,18 @@ const r_62 = r_61.values[0] ?? { type: "null"}; let _ident199 = r_62; const r_63 = r_61.values[1] ?? { type: "null"}; let _sym200 = r_63; -(runtime.info("compiler/syms.phi", 43), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "%- %: %" }), (runtime.info("compiler/syms.phi", 43), _indent40(_depth196)), _ident199, _sym200)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/syms.phi", 43), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "%- %: %" }), (runtime.info("/home/simone/Workspace/phi-lang/compiler/syms.phi", 43), _indent40(_depth196)), _ident199, _sym200)); }; -if (runtime.truthy((runtime.info("compiler/syms.phi", 45), runtime.opNe(_parent197, ({ type: "null" }))))) { -(runtime.info("compiler/syms.phi", 46), _print_syms_node182(_parent197, (runtime.info("compiler/syms.phi", 46), runtime.opAdd(_depth196, ({ type: "int", value: 1 }))))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/syms.phi", 45), runtime.opNe(_parent197, ({ type: "null" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/syms.phi", 46), _print_syms_node182(_parent197, (runtime.info("/home/simone/Workspace/phi-lang/compiler/syms.phi", 46), runtime.opAdd(_depth196, ({ type: "int", value: 1 }))))); }; ; runtime.popCall(); return { type: "null" }; }; function _print_syms183() { -runtime.pushCall("print_syms", "compiler/syms.phi"); -(runtime.info("compiler/syms.phi", 51), _print_syms_node182(_syms184, ({ type: "int", value: 0 }))); +runtime.pushCall("print_syms", "/home/simone/Workspace/phi-lang/compiler/syms.phi"); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/syms.phi", 51), _print_syms_node182(_syms184, ({ type: "int", value: 0 }))); ; runtime.popCall(); return { type: "null" }; @@ -560,67 +560,67 @@ runtime.popCall(); return { type: "null" }; }; -// === resuming file compiler/emit_js.phi === -runtime.setFile("compiler/emit_js.phi"); +// === resuming file /home/simone/Workspace/phi-lang/compiler/emit_js.phi === +runtime.setFile("/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); function _JsEmitter154(_ast201, _initial_filename202) { -runtime.pushCall("JsEmitter", "compiler/emit_js.phi"); +runtime.pushCall("JsEmitter", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); const r_64 = ({ type: "list", values: [] }); let _output224 = r_64; const r_65 = _initial_filename202; let _filename225 = r_65; -const r_66 = (runtime.info("compiler/emit_js.phi", 13), _Syms175()); +const r_66 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 13), _Syms175()); let _syms226 = r_66; -const r_67 = (runtime.info("compiler/emit_js.phi", 15), _Counter155()); +const r_67 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 15), _Counter155()); const r_68 = r_67.values[0] ?? { type: "null"}; let _sym_id_count227 = r_68; const r_69 = r_67.values[1] ?? { type: "null"}; let _sym_id_increment228 = r_69; -const r_70 = (runtime.info("compiler/emit_js.phi", 16), _Counter155()); +const r_70 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 16), _Counter155()); const r_71 = r_70.values[0] ?? { type: "null"}; let _let_node_reg_count229 = r_71; const r_72 = r_70.values[1] ?? { type: "null"}; let _let_node_reg_increment230 = r_72; const r_73 = ({ type: "list", values: [_filename225] }); let _import_stack231 = r_73; -const r_74 = (runtime.info("compiler/emit_js.phi", 19), _map44()); +const r_74 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 19), _map44()); let _imported_files232 = r_74; const r_75 = ({ type: "list", values: [({ type: "list", values: [({ type: "string", value: "format" }), ({ type: "string", value: "builtinFormat" })] }), ({ type: "list", values: [({ type: "string", value: "print" }), ({ type: "string", value: "builtinPrint" })] }), ({ type: "list", values: [({ type: "string", value: "println" }), ({ type: "string", value: "builtinPrintln" })] }), ({ type: "list", values: [({ type: "string", value: "panic" }), ({ type: "string", value: "builtinPanic" })] }), ({ type: "list", values: [({ type: "string", value: "read_text_file" }), ({ type: "string", value: "builtinReadTextFile" })] }), ({ type: "list", values: [({ type: "string", value: "write_text_file" }), ({ type: "string", value: "builtinWriteTextFile" })] }), ({ type: "list", values: [({ type: "string", value: "push" }), ({ type: "string", value: "builtinPush" })] }), ({ type: "list", values: [({ type: "string", value: "at" }), ({ type: "string", value: "builtinAt" })] }), ({ type: "list", values: [({ type: "string", value: "set" }), ({ type: "string", value: "builtinSet" })] }), ({ type: "list", values: [({ type: "string", value: "len" }), ({ type: "string", value: "builtinLen" })] }), ({ type: "list", values: [({ type: "string", value: "string_to_int" }), ({ type: "string", value: "builtinStringToInt" })] }), ({ type: "list", values: [({ type: "string", value: "char_code" }), ({ type: "string", value: "builtinCharCode" })] }), ({ type: "list", values: [({ type: "string", value: "strings_join" }), ({ type: "string", value: "builtinStringsJoin" })] }), ({ type: "list", values: [({ type: "string", value: "get_args" }), ({ type: "string", value: "builtinGetArgs" })] }), ({ type: "list", values: [({ type: "string", value: "fs_basename" }), ({ type: "string", value: "builtinFsBasename" })] }), ({ type: "list", values: [({ type: "string", value: "fs_dirname" }), ({ type: "string", value: "builtinFsDirname" })] }), ({ type: "list", values: [({ type: "string", value: "fs_cwd" }), ({ type: "string", value: "builtinFsCwd" })] }), ({ type: "list", values: [({ type: "string", value: "fs_resolve" }), ({ type: "string", value: "builtinFsResolve" })] })] }); let _builtin_syms233 = r_75; function _generate203() { -runtime.pushCall("generate", "compiler/emit_js.phi"); -(runtime.info("compiler/emit_js.phi", 43), _emit213(({ type: "string", value: "#!/usr/bin/env node\n" }))); -(runtime.info("compiler/emit_js.phi", 44), _emit213(({ type: "string", value: "import { Runtime } from \"./runtime.js\";\n" }))); -(runtime.info("compiler/emit_js.phi", 45), _emit213((runtime.info("compiler/emit_js.phi", 45), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "const runtime = new Runtime(\"%\");\n" }), _filename225)))); +runtime.pushCall("generate", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 43), _emit213(({ type: "string", value: "#!/usr/bin/env node\n" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 44), _emit213(({ type: "string", value: "import { Runtime } from \"./runtime.js\";\n" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 45), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 45), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "const runtime = new Runtime(\"%\");\n" }), _filename225)))); for (const r_76 of _builtin_syms233.values) {; const r_77 = r_76.values[0] ?? { type: "null"}; let _ident234 = r_77; const r_78 = r_76.values[1] ?? { type: "null"}; let _builtin_id235 = r_78; -(runtime.info("compiler/emit_js.phi", 48), _define_builtin214(_ident234, _builtin_id235)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 48), _define_builtin214(_ident234, _builtin_id235)); }; -(runtime.info("compiler/emit_js.phi", 51), _emit213((runtime.info("compiler/emit_js.phi", 51), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "// === emitting file % ===\n" }), _filename225)))); -(runtime.info("compiler/emit_js.phi", 52), _enter_scope218()); -(runtime.info("compiler/emit_js.phi", 53), _discover_syms205(_ast201)); -(runtime.info("compiler/emit_js.phi", 54), _emit_exprs204(_ast201)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 51), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 51), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "// === emitting file % ===\n" }), _filename225)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 52), _enter_scope218()); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 53), _discover_syms205(_ast201)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 54), _emit_exprs204(_ast201)); runtime.popCall(); -return (runtime.info("compiler/emit_js.phi", 55), ((...args) => runtime.builtinStringsJoin(...args))(_output224)); +return (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 55), ((...args) => runtime.builtinStringsJoin(...args))(_output224)); ; runtime.popCall(); return { type: "null" }; }; function _emit_exprs204(_exprs236) { -runtime.pushCall("emit_exprs", "compiler/emit_js.phi"); +runtime.pushCall("emit_exprs", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); for (const r_79 of _exprs236.values) {; let _expr237 = r_79; -(runtime.info("compiler/emit_js.phi", 60), _emit_expr206(_expr237)); -(runtime.info("compiler/emit_js.phi", 61), _emit213(({ type: "string", value: ";\n" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 60), _emit_expr206(_expr237)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 61), _emit213(({ type: "string", value: ";\n" }))); }; ; runtime.popCall(); return { type: "null" }; }; function _discover_syms205(_exprs238) { -runtime.pushCall("discover_syms", "compiler/emit_js.phi"); +runtime.pushCall("discover_syms", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); for (const r_80 of _exprs238.values) {; let _expr239 = r_80; const r_81 = _expr239; @@ -628,7 +628,7 @@ const r_82 = r_81.values[0] ?? { type: "null"}; let _ty240 = r_82; const r_83 = r_81.values[1] ?? { type: "null"}; let _line241 = r_83; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 68), runtime.opNe(_ty240, ({ type: "string", value: "list" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 68), runtime.opNe(_ty240, ({ type: "string", value: "list" }))))) { runtime.popCall(); return { type: "null" }}; const r_84 = _expr239; @@ -636,7 +636,7 @@ const r_85 = r_84.values[0] ?? { type: "null"}; const r_86 = r_84.values[1] ?? { type: "null"}; const r_87 = r_84.values[2] ?? { type: "null"}; let _s242 = r_87; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 70), runtime.opEq((runtime.info("compiler/emit_js.phi", 70), ((...args) => runtime.builtinLen(...args))(_s242)), ({ type: "int", value: 0 }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 70), runtime.opEq((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 70), ((...args) => runtime.builtinLen(...args))(_s242)), ({ type: "int", value: 0 }))))) { runtime.popCall(); return { type: "null" }}; const r_88 = _s242; @@ -645,7 +645,7 @@ const r_90 = r_89.values[0] ?? { type: "null"}; const r_91 = r_89.values[1] ?? { type: "null"}; const r_92 = r_89.values[2] ?? { type: "null"}; let _id243 = r_92; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 72), runtime.opEq(_id243, ({ type: "string", value: "fn" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 72), runtime.opEq(_id243, ({ type: "string", value: "fn" }))))) { const r_93 = _s242; const r_94 = r_93.values[0] ?? { type: "null"}; const r_95 = r_93.values[1] ?? { type: "null"}; @@ -660,7 +660,7 @@ const r_102 = r_99.values[2] ?? { type: "null"}; let _params245 = r_102; const r_103 = r_93.values[3] ?? { type: "null"}; let _body246 = r_103; -(runtime.info("compiler/emit_js.phi", 74), _define_fn215(_ident244, _line241)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 74), _define_fn215(_ident244, _line241)); }; }; ; @@ -668,93 +668,93 @@ runtime.popCall(); return { type: "null" }; }; function _emit_expr206(_expr247) { -runtime.pushCall("emit_expr", "compiler/emit_js.phi"); +runtime.pushCall("emit_expr", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); const r_104 = _expr247; const r_105 = r_104.values[0] ?? { type: "null"}; let _ty248 = r_105; const r_106 = r_104.values[1] ?? { type: "null"}; let _line249 = r_106; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 81), runtime.opEq(_ty248, ({ type: "string", value: "list" }))))) { -(runtime.info("compiler/emit_js.phi", 82), _emit_list207(_expr247)); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 81), runtime.opEq(_ty248, ({ type: "string", value: "list" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 82), _emit_list207(_expr247)); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 83), runtime.opEq(_ty248, ({ type: "string", value: "int" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 83), runtime.opEq(_ty248, ({ type: "string", value: "int" }))))) { const r_107 = _expr247; const r_108 = r_107.values[0] ?? { type: "null"}; const r_109 = r_107.values[1] ?? { type: "null"}; const r_110 = r_107.values[2] ?? { type: "null"}; let _value250 = r_110; -(runtime.info("compiler/emit_js.phi", 85), _emit213((runtime.info("compiler/emit_js.phi", 85), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "({ type: \"int\", value: % })" }), _value250)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 85), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 85), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "({ type: \"int\", value: % })" }), _value250)))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 86), runtime.opEq(_ty248, ({ type: "string", value: "string" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 86), runtime.opEq(_ty248, ({ type: "string", value: "string" }))))) { const r_111 = _expr247; const r_112 = r_111.values[0] ?? { type: "null"}; const r_113 = r_111.values[1] ?? { type: "null"}; const r_114 = r_111.values[2] ?? { type: "null"}; let _value251 = r_114; -(runtime.info("compiler/emit_js.phi", 88), _emit213((runtime.info("compiler/emit_js.phi", 88), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "({ type: \"string\", value: \"%\" })" }), (runtime.info("compiler/emit_js.phi", 88), _string_escape156(_value251)))))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 88), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 88), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "({ type: \"string\", value: \"%\" })" }), (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 88), _string_escape156(_value251)))))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 89), runtime.opEq(_ty248, ({ type: "string", value: "ident" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 89), runtime.opEq(_ty248, ({ type: "string", value: "ident" }))))) { const r_115 = _expr247; const r_116 = r_115.values[0] ?? { type: "null"}; const r_117 = r_115.values[1] ?? { type: "null"}; const r_118 = r_115.values[2] ?? { type: "null"}; let _value252 = r_118; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 92), runtime.opEq(_value252, ({ type: "string", value: "null" }))))) { -(runtime.info("compiler/emit_js.phi", 93), _emit213(({ type: "string", value: "({ type: \"null\" })" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 92), runtime.opEq(_value252, ({ type: "string", value: "null" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 93), _emit213(({ type: "string", value: "({ type: \"null\" })" }))); runtime.popCall(); return { type: "null" }; } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 95), runtime.opEq(_value252, ({ type: "string", value: "false" }))))) { -(runtime.info("compiler/emit_js.phi", 96), _emit213(({ type: "string", value: "({ type: \"bool\", value: false })" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 95), runtime.opEq(_value252, ({ type: "string", value: "false" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 96), _emit213(({ type: "string", value: "({ type: \"bool\", value: false })" }))); runtime.popCall(); return { type: "null" }; } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 98), runtime.opEq(_value252, ({ type: "string", value: "true" }))))) { -(runtime.info("compiler/emit_js.phi", 99), _emit213(({ type: "string", value: "({ type: \"bool\", value: true })" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 98), runtime.opEq(_value252, ({ type: "string", value: "true" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 99), _emit213(({ type: "string", value: "({ type: \"bool\", value: true })" }))); runtime.popCall(); return { type: "null" }; }}}; -const r_119 = (runtime.info("compiler/emit_js.phi", 103), _get_sym221(_value252)); +const r_119 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 103), _get_sym221(_value252)); let _sym253 = r_119; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 104), runtime.opEq(_sym253, ({ type: "null" }))))) { -(runtime.info("compiler/emit_js.phi", 105), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "undefined symbol '%' on line %" }), _value252, _line249)); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 104), runtime.opEq(_sym253, ({ type: "null" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 105), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "undefined symbol '%' on line %" }), _value252, _line249)); }; const r_120 = _sym253; const r_121 = r_120.values[0] ?? { type: "null"}; let _sym_id254 = r_121; const r_122 = r_120.values[1] ?? { type: "null"}; let _sym_ty255 = r_122; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 109), runtime.opEq(_sym_ty255, ({ type: "string", value: "builtin" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 109), runtime.opEq(_sym_ty255, ({ type: "string", value: "builtin" }))))) { const r_123 = _sym253; const r_124 = r_123.values[0] ?? { type: "null"}; const r_125 = r_123.values[1] ?? { type: "null"}; const r_126 = r_123.values[2] ?? { type: "null"}; let _id256 = r_126; -(runtime.info("compiler/emit_js.phi", 111), _emit213((runtime.info("compiler/emit_js.phi", 111), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "((...args) => runtime.%(...args))" }), _id256)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 111), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 111), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "((...args) => runtime.%(...args))" }), _id256)))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 112), runtime.opEq(_sym_ty255, ({ type: "string", value: "fn" }))))) { -(runtime.info("compiler/emit_js.phi", 113), _emit213((runtime.info("compiler/emit_js.phi", 113), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value252, _sym_id254)))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 112), runtime.opEq(_sym_ty255, ({ type: "string", value: "fn" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 113), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 113), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value252, _sym_id254)))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 114), runtime.opEq(_sym_ty255, ({ type: "string", value: "param" }))))) { -(runtime.info("compiler/emit_js.phi", 115), _emit213((runtime.info("compiler/emit_js.phi", 115), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value252, _sym_id254)))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 114), runtime.opEq(_sym_ty255, ({ type: "string", value: "param" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 115), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 115), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value252, _sym_id254)))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 116), runtime.opEq(_sym_ty255, ({ type: "string", value: "let" }))))) { -(runtime.info("compiler/emit_js.phi", 117), _emit213((runtime.info("compiler/emit_js.phi", 117), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value252, _sym_id254)))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 116), runtime.opEq(_sym_ty255, ({ type: "string", value: "let" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 117), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 117), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value252, _sym_id254)))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 118), runtime.opEq(_sym_ty255, ({ type: "string", value: "imported" }))))) { -(runtime.info("compiler/emit_js.phi", 123), _emit213((runtime.info("compiler/emit_js.phi", 123), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value252, _sym_id254)))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 118), runtime.opEq(_sym_ty255, ({ type: "string", value: "imported" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 123), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 123), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value252, _sym_id254)))); } else { -(runtime.info("compiler/emit_js.phi", 125), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "not implemented '%'" }), _sym_ty255)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 125), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "not implemented '%'" }), _sym_ty255)); }}}}}; } else { -(runtime.info("compiler/emit_js.phi", 128), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "unknown expr type '%' on line %" }), _ty248, _line249)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 128), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "unknown expr type '%' on line %" }), _ty248, _line249)); }}}}; ; runtime.popCall(); return { type: "null" }; }; function _emit_list207(_expr257) { -runtime.pushCall("emit_list", "compiler/emit_js.phi"); +runtime.pushCall("emit_list", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); const r_127 = _expr257; const r_128 = r_127.values[0] ?? { type: "null"}; let _ty258 = r_128; @@ -762,8 +762,8 @@ const r_129 = r_127.values[1] ?? { type: "null"}; let _line259 = r_129; const r_130 = r_127.values[2] ?? { type: "null"}; let _s260 = r_130; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 134), runtime.opEq((runtime.info("compiler/emit_js.phi", 134), ((...args) => runtime.builtinLen(...args))(_s260)), ({ type: "int", value: 0 }))))) { -(runtime.info("compiler/emit_js.phi", 135), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "illegal function on line %" }), _line259)); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 134), runtime.opEq((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 134), ((...args) => runtime.builtinLen(...args))(_s260)), ({ type: "int", value: 0 }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 135), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "illegal function on line %" }), _line259)); }; const r_131 = _s260; const r_132 = r_131.values[0] ?? { type: "null"}; @@ -772,638 +772,640 @@ let _id_ty261 = r_133; const r_134 = r_132.values[1] ?? { type: "null"}; const r_135 = r_132.values[2] ?? { type: "null"}; let _id262 = r_135; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 138), runtime.opNe(_id_ty261, ({ type: "string", value: "ident" }))))) { -(runtime.info("compiler/emit_js.phi", 139), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "illegal function on line %" }), _line259)); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 138), runtime.opNe(_id_ty261, ({ type: "string", value: "ident" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 139), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "illegal function on line %" }), _line259)); }; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 141), runtime.opEq(_id262, ({ type: "string", value: "import" }))))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 141), runtime.opEq(_id262, ({ type: "string", value: "import" }))))) { const r_136 = _s260; const r_137 = r_136.values[0] ?? { type: "null"}; const r_138 = r_136.values[1] ?? { type: "null"}; const r_139 = r_138.values[0] ?? { type: "null"}; const r_140 = r_138.values[1] ?? { type: "null"}; const r_141 = r_138.values[2] ?? { type: "null"}; -let _inner_filename263 = r_141; +let _inner_filename_rel263 = r_141; const r_142 = r_136.values[2] ?? { type: "null"}; const r_143 = r_142.values[0] ?? { type: "null"}; const r_144 = r_142.values[1] ?? { type: "null"}; const r_145 = r_142.values[2] ?? { type: "null"}; let _idents264 = r_145; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 144), _list_contains43(_import_stack231, _inner_filename263)))) { -(runtime.info("compiler/emit_js.phi", 145), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "circular dependendy: '%' imports '%'" }), _filename225, _inner_filename263)); +const r_146 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 144), ((...args) => runtime.builtinFsResolve(...args))((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 144), ((...args) => runtime.builtinFsDirname(...args))(_filename225)), _inner_filename_rel263)); +let _inner_filename265 = r_146; +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 146), _list_contains43(_import_stack231, _inner_filename265)))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 147), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "circular dependendy: '%' imports '%'" }), _filename225, _inner_filename265)); }; -(runtime.info("compiler/emit_js.phi", 147), _list_push41(_import_stack231, _inner_filename263)); -const r_146 = ({ type: "null" }); -let _sym_map265 = r_146; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 151), _map_has45(_imported_files232, _inner_filename263)))) { -(_sym_map265 = (runtime.info("compiler/emit_js.phi", 152), _map_get46(_imported_files232, _inner_filename263))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 149), _list_push41(_import_stack231, _inner_filename265)); +const r_147 = ({ type: "null" }); +let _sym_map266 = r_147; +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 153), _map_has45(_imported_files232, _inner_filename265)))) { +(_sym_map266 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 154), _map_get46(_imported_files232, _inner_filename265))); } else { -(runtime.info("compiler/emit_js.phi", 154), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "compiling '%'" }), _inner_filename263)); -const r_147 = _filename225; -let _outer_filename266 = r_147; -(_filename225 = _inner_filename263); -const r_148 = (runtime.info("compiler/emit_js.phi", 158), ((...args) => runtime.builtinReadTextFile(...args))(_filename225)); -let _text267 = r_148; -const r_149 = (runtime.info("compiler/emit_js.phi", 159), _tokenize107(_text267)); -let _tokens268 = r_149; -const r_150 = (runtime.info("compiler/emit_js.phi", 160), _Parser106(_tokens268)); -let _parser269 = r_150; -const r_151 = _parser269; -const r_152 = r_151.values[0] ?? { type: "null"}; -let _parse270 = r_152; -const r_153 = (runtime.info("compiler/emit_js.phi", 162), _parse270()); -let _ast271 = r_153; -(runtime.info("compiler/emit_js.phi", 164), _emit213((runtime.info("compiler/emit_js.phi", 164), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "// === emitting file % ===\n" }), _filename225)))); -(runtime.info("compiler/emit_js.phi", 165), _emit213((runtime.info("compiler/emit_js.phi", 165), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.setFile(\"%\");\n" }), _filename225)))); -const r_154 = _syms226; -let _outer_syms272 = r_154; -(_syms226 = (runtime.info("compiler/emit_js.phi", 168), _Syms175())); -for (const r_155 of _builtin_syms233.values) {; -const r_156 = r_155.values[0] ?? { type: "null"}; -let _ident273 = r_156; -const r_157 = r_155.values[1] ?? { type: "null"}; -let _builtin_id274 = r_157; -(runtime.info("compiler/emit_js.phi", 170), _define_builtin214(_ident273, _builtin_id274)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 156), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "compiling '%'" }), _inner_filename265)); +const r_148 = _filename225; +let _outer_filename267 = r_148; +(_filename225 = _inner_filename265); +const r_149 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 160), ((...args) => runtime.builtinReadTextFile(...args))(_filename225)); +let _text268 = r_149; +const r_150 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 161), _tokenize107(_text268)); +let _tokens269 = r_150; +const r_151 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 162), _Parser106(_tokens269)); +let _parser270 = r_151; +const r_152 = _parser270; +const r_153 = r_152.values[0] ?? { type: "null"}; +let _parse271 = r_153; +const r_154 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 164), _parse271()); +let _ast272 = r_154; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 166), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 166), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "// === emitting file % ===\n" }), _filename225)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 167), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 167), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.setFile(\"%\");\n" }), _filename225)))); +const r_155 = _syms226; +let _outer_syms273 = r_155; +(_syms226 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 170), _Syms175())); +for (const r_156 of _builtin_syms233.values) {; +const r_157 = r_156.values[0] ?? { type: "null"}; +let _ident274 = r_157; +const r_158 = r_156.values[1] ?? { type: "null"}; +let _builtin_id275 = r_158; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 172), _define_builtin214(_ident274, _builtin_id275)); }; -(runtime.info("compiler/emit_js.phi", 173), _enter_scope218()); -(runtime.info("compiler/emit_js.phi", 174), _discover_syms205(_ast271)); -(runtime.info("compiler/emit_js.phi", 175), _emit_exprs204(_ast271)); -(_sym_map265 = (runtime.info("compiler/emit_js.phi", 176), _get_current_map222())); -(runtime.info("compiler/emit_js.phi", 177), _map_set47(_imported_files232, _filename225, _sym_map265)); -(_syms226 = _outer_syms272); -(_filename225 = _outer_filename266); -(runtime.info("compiler/emit_js.phi", 182), _emit213((runtime.info("compiler/emit_js.phi", 182), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "\n// === resuming file % ===\n" }), _outer_filename266)))); -(runtime.info("compiler/emit_js.phi", 183), _emit213((runtime.info("compiler/emit_js.phi", 183), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.setFile(\"%\")" }), _outer_filename266)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 175), _enter_scope218()); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 176), _discover_syms205(_ast272)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 177), _emit_exprs204(_ast272)); +(_sym_map266 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 178), _get_current_map222())); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 179), _map_set47(_imported_files232, _filename225, _sym_map266)); +(_syms226 = _outer_syms273); +(_filename225 = _outer_filename267); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 184), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 184), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "\n// === resuming file % ===\n" }), _outer_filename267)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 185), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 185), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.setFile(\"%\")" }), _outer_filename267)))); }; -(runtime.info("compiler/emit_js.phi", 185), _list_pop42(_import_stack231)); -for (const r_158 of _idents264.values) {; -const r_159 = r_158.values[0] ?? { type: "null"}; -const r_160 = r_158.values[1] ?? { type: "null"}; -const r_161 = r_158.values[2] ?? { type: "null"}; -let _ident275 = r_161; -const r_162 = ({ type: "null" }); -let _sym276 = r_162; -for (const r_163 of _sym_map265.values) {; -const r_164 = r_163.values[0] ?? { type: "null"}; -let _sym_ident277 = r_164; -const r_165 = r_163.values[1] ?? { type: "null"}; -let _found_sym278 = r_165; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 190), runtime.opEq(_sym_ident277, _ident275)))) { -(_sym276 = _found_sym278); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 187), _list_pop42(_import_stack231)); +for (const r_159 of _idents264.values) {; +const r_160 = r_159.values[0] ?? { type: "null"}; +const r_161 = r_159.values[1] ?? { type: "null"}; +const r_162 = r_159.values[2] ?? { type: "null"}; +let _ident276 = r_162; +const r_163 = ({ type: "null" }); +let _sym277 = r_163; +for (const r_164 of _sym_map266.values) {; +const r_165 = r_164.values[0] ?? { type: "null"}; +let _sym_ident278 = r_165; +const r_166 = r_164.values[1] ?? { type: "null"}; +let _found_sym279 = r_166; +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 192), runtime.opEq(_sym_ident278, _ident276)))) { +(_sym277 = _found_sym279); break; }; }; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 195), runtime.opEq(_sym276, ({ type: "null" }))))) { -(runtime.info("compiler/emit_js.phi", 196), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "no symbol '%' from imported '%'" }), _ident275, _inner_filename263)); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 197), runtime.opEq(_sym277, ({ type: "null" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 198), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "no symbol '%' from imported '%'" }), _ident276, _inner_filename265)); }; -const r_166 = _sym276; -const r_167 = r_166.values[0] ?? { type: "null"}; -const r_168 = r_166.values[1] ?? { type: "null"}; -let _sym_type279 = r_168; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 199), runtime.opEq(_sym_type279, ({ type: "string", value: "imported" }))))) { -(runtime.info("compiler/emit_js.phi", 200), _define_sym220(_ident275, _sym276)); +const r_167 = _sym277; +const r_168 = r_167.values[0] ?? { type: "null"}; +const r_169 = r_167.values[1] ?? { type: "null"}; +let _sym_type280 = r_169; +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 201), runtime.opEq(_sym_type280, ({ type: "string", value: "imported" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 202), _define_sym220(_ident276, _sym277)); } else { -const r_169 = _sym276; -const r_170 = r_169.values[0] ?? { type: "null"}; -let _sym_id280 = r_170; -(runtime.info("compiler/emit_js.phi", 203), _define_sym220(_ident275, ({ type: "list", values: [_sym_id280, ({ type: "string", value: "imported" }), _sym276] }))); +const r_170 = _sym277; +const r_171 = r_170.values[0] ?? { type: "null"}; +let _sym_id281 = r_171; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 205), _define_sym220(_ident276, ({ type: "list", values: [_sym_id281, ({ type: "string", value: "imported" }), _sym277] }))); }; }; } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 206), runtime.opEq(_id262, ({ type: "string", value: "fn" }))))) { -const r_171 = _s260; -const r_172 = r_171.values[0] ?? { type: "null"}; -const r_173 = r_171.values[1] ?? { type: "null"}; -const r_174 = r_173.values[0] ?? { type: "null"}; -const r_175 = r_173.values[1] ?? { type: "null"}; -const r_176 = r_173.values[2] ?? { type: "null"}; -let _ident281 = r_176; -const r_177 = r_171.values[2] ?? { type: "null"}; -const r_178 = r_177.values[0] ?? { type: "null"}; -const r_179 = r_177.values[1] ?? { type: "null"}; -const r_180 = r_177.values[2] ?? { type: "null"}; -let _params282 = r_180; -const r_181 = r_171.values[3] ?? { type: "null"}; -let _body283 = r_181; -const r_182 = (runtime.info("compiler/emit_js.phi", 209), _get_sym221(_ident281)); -let _sym284 = r_182; -const r_183 = _sym284; -const r_184 = r_183.values[0] ?? { type: "null"}; -let _sym_id285 = r_184; -(runtime.info("compiler/emit_js.phi", 212), _emit213((runtime.info("compiler/emit_js.phi", 212), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "function _%%(" }), _ident281, _sym_id285)))); -(runtime.info("compiler/emit_js.phi", 214), _enter_scope218()); -const r_185 = ({ type: "bool", value: true }); -let _first286 = r_185; -for (const r_186 of _params282.values) {; -const r_187 = r_186.values[0] ?? { type: "null"}; -const r_188 = r_186.values[1] ?? { type: "null"}; -const r_189 = r_186.values[2] ?? { type: "null"}; -let _ident287 = r_189; -if (runtime.truthy(runtime.opNot(_first286))) { -(runtime.info("compiler/emit_js.phi", 219), _emit213(({ type: "string", value: ", " }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 208), runtime.opEq(_id262, ({ type: "string", value: "fn" }))))) { +const r_172 = _s260; +const r_173 = r_172.values[0] ?? { type: "null"}; +const r_174 = r_172.values[1] ?? { type: "null"}; +const r_175 = r_174.values[0] ?? { type: "null"}; +const r_176 = r_174.values[1] ?? { type: "null"}; +const r_177 = r_174.values[2] ?? { type: "null"}; +let _ident282 = r_177; +const r_178 = r_172.values[2] ?? { type: "null"}; +const r_179 = r_178.values[0] ?? { type: "null"}; +const r_180 = r_178.values[1] ?? { type: "null"}; +const r_181 = r_178.values[2] ?? { type: "null"}; +let _params283 = r_181; +const r_182 = r_172.values[3] ?? { type: "null"}; +let _body284 = r_182; +const r_183 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 211), _get_sym221(_ident282)); +let _sym285 = r_183; +const r_184 = _sym285; +const r_185 = r_184.values[0] ?? { type: "null"}; +let _sym_id286 = r_185; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 214), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 214), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "function _%%(" }), _ident282, _sym_id286)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 216), _enter_scope218()); +const r_186 = ({ type: "bool", value: true }); +let _first287 = r_186; +for (const r_187 of _params283.values) {; +const r_188 = r_187.values[0] ?? { type: "null"}; +const r_189 = r_187.values[1] ?? { type: "null"}; +const r_190 = r_187.values[2] ?? { type: "null"}; +let _ident288 = r_190; +if (runtime.truthy(runtime.opNot(_first287))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 221), _emit213(({ type: "string", value: ", " }))); }; -(_first286 = ({ type: "bool", value: false })); -const r_190 = (runtime.info("compiler/emit_js.phi", 223), _define_param216(_ident287, _line259)); -let _sym_id288 = r_190; -(runtime.info("compiler/emit_js.phi", 224), _emit213((runtime.info("compiler/emit_js.phi", 224), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _ident287, _sym_id288)))); +(_first287 = ({ type: "bool", value: false })); +const r_191 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 225), _define_param216(_ident288, _line259)); +let _sym_id289 = r_191; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 226), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 226), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _ident288, _sym_id289)))); }; -(runtime.info("compiler/emit_js.phi", 228), _emit213(({ type: "string", value: ") {\n" }))); -(runtime.info("compiler/emit_js.phi", 229), _emit213((runtime.info("compiler/emit_js.phi", 229), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.pushCall(\"%\", \"%\");\n" }), _ident281, _filename225)))); -(runtime.info("compiler/emit_js.phi", 231), _emit_expr206(_body283)); -(runtime.info("compiler/emit_js.phi", 232), _emit213(({ type: "string", value: ";\nruntime.popCall();\nreturn { type: \"null\" };\n}" }))); -(runtime.info("compiler/emit_js.phi", 234), _leave_scope219()); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 230), _emit213(({ type: "string", value: ") {\n" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 231), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 231), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.pushCall(\"%\", \"%\");\n" }), _ident282, _filename225)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 233), _emit_expr206(_body284)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 234), _emit213(({ type: "string", value: ";\nruntime.popCall();\nreturn { type: \"null\" };\n}" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 236), _leave_scope219()); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 235), runtime.opEq(_id262, ({ type: "string", value: "let" }))))) { -const r_191 = _s260; -const r_192 = r_191.values[0] ?? { type: "null"}; -const r_193 = r_191.values[1] ?? { type: "null"}; -let _pat289 = r_193; -const r_194 = r_191.values[2] ?? { type: "null"}; -let _expr290 = r_194; -const r_195 = (runtime.info("compiler/emit_js.phi", 237), _let_node_reg_count229()); -let _reg291 = r_195; -(runtime.info("compiler/emit_js.phi", 238), _let_node_reg_increment230()); -(runtime.info("compiler/emit_js.phi", 239), _emit213((runtime.info("compiler/emit_js.phi", 239), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "const r_% = " }), _reg291)))); -(runtime.info("compiler/emit_js.phi", 240), _emit_expr206(_expr290)); -(runtime.info("compiler/emit_js.phi", 241), _emit_let_node209(_pat289, _reg291)); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 237), runtime.opEq(_id262, ({ type: "string", value: "let" }))))) { +const r_192 = _s260; +const r_193 = r_192.values[0] ?? { type: "null"}; +const r_194 = r_192.values[1] ?? { type: "null"}; +let _pat290 = r_194; +const r_195 = r_192.values[2] ?? { type: "null"}; +let _expr291 = r_195; +const r_196 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 239), _let_node_reg_count229()); +let _reg292 = r_196; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 240), _let_node_reg_increment230()); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 241), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 241), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "const r_% = " }), _reg292)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 242), _emit_expr206(_expr291)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 243), _emit_let_node209(_pat290, _reg292)); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 242), runtime.opEq(_id262, ({ type: "string", value: "do" }))))) { -(runtime.info("compiler/emit_js.phi", 243), _enter_scope218()); -(runtime.info("compiler/emit_js.phi", 244), _discover_syms205((runtime.info("compiler/emit_js.phi", 244), _slice37(_s260, ({ type: "int", value: 1 }))))); -(runtime.info("compiler/emit_js.phi", 245), _emit_exprs204((runtime.info("compiler/emit_js.phi", 245), _slice37(_s260, ({ type: "int", value: 1 }))))); -(runtime.info("compiler/emit_js.phi", 246), _leave_scope219()); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 244), runtime.opEq(_id262, ({ type: "string", value: "do" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 245), _enter_scope218()); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 246), _discover_syms205((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 246), _slice37(_s260, ({ type: "int", value: 1 }))))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 247), _emit_exprs204((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 247), _slice37(_s260, ({ type: "int", value: 1 }))))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 248), _leave_scope219()); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 247), runtime.opEq(_id262, ({ type: "string", value: "for" }))))) { -const r_196 = _s260; -const r_197 = r_196.values[0] ?? { type: "null"}; -const r_198 = r_196.values[1] ?? { type: "null"}; -let _pat292 = r_198; -const r_199 = r_196.values[2] ?? { type: "null"}; -let _expr293 = r_199; -const r_200 = r_196.values[3] ?? { type: "null"}; -let _body294 = r_200; -const r_201 = (runtime.info("compiler/emit_js.phi", 250), _let_node_reg_count229()); -let _reg295 = r_201; -(runtime.info("compiler/emit_js.phi", 251), _let_node_reg_increment230()); -(runtime.info("compiler/emit_js.phi", 252), _emit213((runtime.info("compiler/emit_js.phi", 252), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "for (const r_% of " }), _reg295)))); -(runtime.info("compiler/emit_js.phi", 253), _emit_expr206(_expr293)); -(runtime.info("compiler/emit_js.phi", 254), _emit213(({ type: "string", value: ".values) {" }))); -(runtime.info("compiler/emit_js.phi", 256), _enter_scope218()); -(runtime.info("compiler/emit_js.phi", 257), _emit_let_node209(_pat292, _reg295)); -(runtime.info("compiler/emit_js.phi", 258), _enter_scope218()); -(runtime.info("compiler/emit_js.phi", 260), _emit213(({ type: "string", value: ";\n" }))); -(runtime.info("compiler/emit_js.phi", 261), _emit_expr206(_body294)); -(runtime.info("compiler/emit_js.phi", 262), _emit213(({ type: "string", value: "}" }))); -(runtime.info("compiler/emit_js.phi", 264), _leave_scope219()); -(runtime.info("compiler/emit_js.phi", 265), _leave_scope219()); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 249), runtime.opEq(_id262, ({ type: "string", value: "for" }))))) { +const r_197 = _s260; +const r_198 = r_197.values[0] ?? { type: "null"}; +const r_199 = r_197.values[1] ?? { type: "null"}; +let _pat293 = r_199; +const r_200 = r_197.values[2] ?? { type: "null"}; +let _expr294 = r_200; +const r_201 = r_197.values[3] ?? { type: "null"}; +let _body295 = r_201; +const r_202 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 252), _let_node_reg_count229()); +let _reg296 = r_202; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 253), _let_node_reg_increment230()); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 254), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 254), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "for (const r_% of " }), _reg296)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 255), _emit_expr206(_expr294)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 256), _emit213(({ type: "string", value: ".values) {" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 258), _enter_scope218()); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 259), _emit_let_node209(_pat293, _reg296)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 260), _enter_scope218()); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 262), _emit213(({ type: "string", value: ";\n" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 263), _emit_expr206(_body295)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 264), _emit213(({ type: "string", value: "}" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 266), _leave_scope219()); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 267), _leave_scope219()); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 266), runtime.opEq(_id262, ({ type: "string", value: "loop" }))))) { -const r_202 = _s260; -const r_203 = r_202.values[0] ?? { type: "null"}; -const r_204 = r_202.values[1] ?? { type: "null"}; -let _body296 = r_204; -(runtime.info("compiler/emit_js.phi", 268), _emit213(({ type: "string", value: "while (true) {\n" }))); -(runtime.info("compiler/emit_js.phi", 269), _emit_expr206(_body296)); -(runtime.info("compiler/emit_js.phi", 270), _emit213(({ type: "string", value: "}" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 268), runtime.opEq(_id262, ({ type: "string", value: "loop" }))))) { +const r_203 = _s260; +const r_204 = r_203.values[0] ?? { type: "null"}; +const r_205 = r_203.values[1] ?? { type: "null"}; +let _body297 = r_205; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 270), _emit213(({ type: "string", value: "while (true) {\n" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 271), _emit_expr206(_body297)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 272), _emit213(({ type: "string", value: "}" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 271), runtime.opEq(_id262, ({ type: "string", value: "if" }))))) { -const r_205 = _s260; -const r_206 = r_205.values[0] ?? { type: "null"}; -const r_207 = r_205.values[1] ?? { type: "null"}; -let _cond297 = r_207; -const r_208 = r_205.values[2] ?? { type: "null"}; -let _truthy298 = r_208; -const r_209 = r_205.values[3] ?? { type: "null"}; -let _falsy299 = r_209; -(runtime.info("compiler/emit_js.phi", 273), _emit213(({ type: "string", value: "if (runtime.truthy(" }))); -(runtime.info("compiler/emit_js.phi", 274), _emit_expr206(_cond297)); -(runtime.info("compiler/emit_js.phi", 275), _emit213(({ type: "string", value: ")) {\n" }))); -(runtime.info("compiler/emit_js.phi", 276), _emit_expr206(_truthy298)); -(runtime.info("compiler/emit_js.phi", 277), _emit213(({ type: "string", value: "}" }))); -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 278), runtime.opNe(_falsy299, ({ type: "null" }))))) { -(runtime.info("compiler/emit_js.phi", 279), _emit213(({ type: "string", value: " else {\n" }))); -(runtime.info("compiler/emit_js.phi", 280), _emit_expr206(_falsy299)); -(runtime.info("compiler/emit_js.phi", 281), _emit213(({ type: "string", value: "}" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 273), runtime.opEq(_id262, ({ type: "string", value: "if" }))))) { +const r_206 = _s260; +const r_207 = r_206.values[0] ?? { type: "null"}; +const r_208 = r_206.values[1] ?? { type: "null"}; +let _cond298 = r_208; +const r_209 = r_206.values[2] ?? { type: "null"}; +let _truthy299 = r_209; +const r_210 = r_206.values[3] ?? { type: "null"}; +let _falsy300 = r_210; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 275), _emit213(({ type: "string", value: "if (runtime.truthy(" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 276), _emit_expr206(_cond298)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 277), _emit213(({ type: "string", value: ")) {\n" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 278), _emit_expr206(_truthy299)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 279), _emit213(({ type: "string", value: "}" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 280), runtime.opNe(_falsy300, ({ type: "null" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 281), _emit213(({ type: "string", value: " else {\n" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 282), _emit_expr206(_falsy300)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 283), _emit213(({ type: "string", value: "}" }))); }; } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 283), runtime.opEq(_id262, ({ type: "string", value: "return" }))))) { -const r_210 = _s260; -const r_211 = r_210.values[0] ?? { type: "null"}; -const r_212 = r_210.values[1] ?? { type: "null"}; -let _value300 = r_212; -(runtime.info("compiler/emit_js.phi", 285), _emit213(({ type: "string", value: "runtime.popCall();\n" }))); -(runtime.info("compiler/emit_js.phi", 286), _emit213(({ type: "string", value: "return " }))); -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 287), runtime.opNe(_value300, ({ type: "null" }))))) { -(runtime.info("compiler/emit_js.phi", 288), _emit_expr206(_value300)); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 285), runtime.opEq(_id262, ({ type: "string", value: "return" }))))) { +const r_211 = _s260; +const r_212 = r_211.values[0] ?? { type: "null"}; +const r_213 = r_211.values[1] ?? { type: "null"}; +let _value301 = r_213; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 287), _emit213(({ type: "string", value: "runtime.popCall();\n" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 288), _emit213(({ type: "string", value: "return " }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 289), runtime.opNe(_value301, ({ type: "null" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 290), _emit_expr206(_value301)); } else { -(runtime.info("compiler/emit_js.phi", 290), _emit213(({ type: "string", value: "{ type: \"null\" }" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 292), _emit213(({ type: "string", value: "{ type: \"null\" }" }))); }; } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 292), runtime.opEq(_id262, ({ type: "string", value: "break" }))))) { -const r_213 = _s260; -const r_214 = r_213.values[0] ?? { type: "null"}; -const r_215 = r_213.values[1] ?? { type: "null"}; -let _value301 = r_215; -(runtime.info("compiler/emit_js.phi", 294), _emit213(({ type: "string", value: "break" }))); -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 295), runtime.opNe(_value301, ({ type: "null" }))))) { -(runtime.info("compiler/emit_js.phi", 296), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "not implemented" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 294), runtime.opEq(_id262, ({ type: "string", value: "break" }))))) { +const r_214 = _s260; +const r_215 = r_214.values[0] ?? { type: "null"}; +const r_216 = r_214.values[1] ?? { type: "null"}; +let _value302 = r_216; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 296), _emit213(({ type: "string", value: "break" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 297), runtime.opNe(_value302, ({ type: "null" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 298), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "not implemented" }))); }; } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 298), runtime.opEq(_id262, ({ type: "string", value: "call" }))))) { -const r_216 = _s260; -const r_217 = r_216.values[0] ?? { type: "null"}; -const r_218 = r_216.values[1] ?? { type: "null"}; -let _callee302 = r_218; -const r_219 = (runtime.info("compiler/emit_js.phi", 300), _slice37(_s260, ({ type: "int", value: 2 }))); -let _args303 = r_219; -(runtime.info("compiler/emit_js.phi", 301), _emit213((runtime.info("compiler/emit_js.phi", 301), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%, " }), (runtime.info("compiler/emit_js.phi", 301), _rt_info211(_line259)))))); -(runtime.info("compiler/emit_js.phi", 302), _emit_expr206(_callee302)); -(runtime.info("compiler/emit_js.phi", 303), _emit213(({ type: "string", value: "(" }))); -const r_220 = ({ type: "bool", value: true }); -let _first304 = r_220; -for (const r_221 of _args303.values) {; -let _arg305 = r_221; -if (runtime.truthy(runtime.opNot(_first304))) { -(runtime.info("compiler/emit_js.phi", 308), _emit213(({ type: "string", value: ", " }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 300), runtime.opEq(_id262, ({ type: "string", value: "call" }))))) { +const r_217 = _s260; +const r_218 = r_217.values[0] ?? { type: "null"}; +const r_219 = r_217.values[1] ?? { type: "null"}; +let _callee303 = r_219; +const r_220 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 302), _slice37(_s260, ({ type: "int", value: 2 }))); +let _args304 = r_220; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 303), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 303), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%, " }), (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 303), _rt_info211(_line259)))))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 304), _emit_expr206(_callee303)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 305), _emit213(({ type: "string", value: "(" }))); +const r_221 = ({ type: "bool", value: true }); +let _first305 = r_221; +for (const r_222 of _args304.values) {; +let _arg306 = r_222; +if (runtime.truthy(runtime.opNot(_first305))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 310), _emit213(({ type: "string", value: ", " }))); }; -(_first304 = ({ type: "bool", value: false })); -(runtime.info("compiler/emit_js.phi", 312), _emit_expr206(_arg305)); +(_first305 = ({ type: "bool", value: false })); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 314), _emit_expr206(_arg306)); }; -(runtime.info("compiler/emit_js.phi", 315), _emit213(({ type: "string", value: "))" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 317), _emit213(({ type: "string", value: "))" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 316), runtime.opEq(_id262, ({ type: "string", value: "list" }))))) { -(runtime.info("compiler/emit_js.phi", 317), _emit_list_literal208((runtime.info("compiler/emit_js.phi", 317), _slice37(_s260, ({ type: "int", value: 1 }))))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 318), runtime.opEq(_id262, ({ type: "string", value: "list" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 319), _emit_list_literal208((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 319), _slice37(_s260, ({ type: "int", value: 1 }))))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 318), runtime.opEq(_id262, ({ type: "string", value: "=" }))))) { -(runtime.info("compiler/emit_js.phi", 319), _emit_assign_expr212(_s260, _line259, ({ type: "string", value: "=" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 320), runtime.opEq(_id262, ({ type: "string", value: "=" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 321), _emit_assign_expr212(_s260, _line259, ({ type: "string", value: "=" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 320), runtime.opEq(_id262, ({ type: "string", value: "+=" }))))) { -(runtime.info("compiler/emit_js.phi", 321), _emit_assign_expr212(_s260, _line259, ({ type: "string", value: "+" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 322), runtime.opEq(_id262, ({ type: "string", value: "+=" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 323), _emit_assign_expr212(_s260, _line259, ({ type: "string", value: "+" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 322), runtime.opEq(_id262, ({ type: "string", value: "-=" }))))) { -(runtime.info("compiler/emit_js.phi", 323), _emit_assign_expr212(_s260, _line259, ({ type: "string", value: "-" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 324), runtime.opEq(_id262, ({ type: "string", value: "-=" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 325), _emit_assign_expr212(_s260, _line259, ({ type: "string", value: "-" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 324), runtime.opEq(_id262, ({ type: "string", value: "or" }))))) { -const r_222 = _s260; -const r_223 = r_222.values[0] ?? { type: "null"}; -const r_224 = r_222.values[1] ?? { type: "null"}; -let _left306 = r_224; -const r_225 = r_222.values[2] ?? { type: "null"}; -let _right307 = r_225; -(runtime.info("compiler/emit_js.phi", 326), _emit213((runtime.info("compiler/emit_js.phi", 326), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%" }), (runtime.info("compiler/emit_js.phi", 326), _rt_info211(_line259)), _line259)))); -(runtime.info("compiler/emit_js.phi", 327), _emit213(({ type: "string", value: ", { type: \"bool\", value: runtime.truthy(" }))); -(runtime.info("compiler/emit_js.phi", 328), _emit_expr206(_left306)); -(runtime.info("compiler/emit_js.phi", 329), _emit213(({ type: "string", value: ") || runtime.truthy(" }))); -(runtime.info("compiler/emit_js.phi", 330), _emit_expr206(_right307)); -(runtime.info("compiler/emit_js.phi", 331), _emit213(({ type: "string", value: ") })" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 326), runtime.opEq(_id262, ({ type: "string", value: "or" }))))) { +const r_223 = _s260; +const r_224 = r_223.values[0] ?? { type: "null"}; +const r_225 = r_223.values[1] ?? { type: "null"}; +let _left307 = r_225; +const r_226 = r_223.values[2] ?? { type: "null"}; +let _right308 = r_226; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 328), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 328), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%" }), (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 328), _rt_info211(_line259)), _line259)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 329), _emit213(({ type: "string", value: ", { type: \"bool\", value: runtime.truthy(" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 330), _emit_expr206(_left307)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 331), _emit213(({ type: "string", value: ") || runtime.truthy(" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 332), _emit_expr206(_right308)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 333), _emit213(({ type: "string", value: ") })" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 332), runtime.opEq(_id262, ({ type: "string", value: "and" }))))) { -const r_226 = _s260; -const r_227 = r_226.values[0] ?? { type: "null"}; -const r_228 = r_226.values[1] ?? { type: "null"}; -let _left308 = r_228; -const r_229 = r_226.values[2] ?? { type: "null"}; -let _right309 = r_229; -(runtime.info("compiler/emit_js.phi", 334), _emit213((runtime.info("compiler/emit_js.phi", 334), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%" }), (runtime.info("compiler/emit_js.phi", 334), _rt_info211(_line259)), _line259)))); -(runtime.info("compiler/emit_js.phi", 335), _emit213(({ type: "string", value: ", { type: \"bool\", value: runtime.truthy(" }))); -(runtime.info("compiler/emit_js.phi", 336), _emit_expr206(_left308)); -(runtime.info("compiler/emit_js.phi", 337), _emit213(({ type: "string", value: ") && runtime.truthy(" }))); -(runtime.info("compiler/emit_js.phi", 338), _emit_expr206(_right309)); -(runtime.info("compiler/emit_js.phi", 339), _emit213(({ type: "string", value: ") })" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 334), runtime.opEq(_id262, ({ type: "string", value: "and" }))))) { +const r_227 = _s260; +const r_228 = r_227.values[0] ?? { type: "null"}; +const r_229 = r_227.values[1] ?? { type: "null"}; +let _left309 = r_229; +const r_230 = r_227.values[2] ?? { type: "null"}; +let _right310 = r_230; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 336), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 336), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%" }), (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 336), _rt_info211(_line259)), _line259)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 337), _emit213(({ type: "string", value: ", { type: \"bool\", value: runtime.truthy(" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 338), _emit_expr206(_left309)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 339), _emit213(({ type: "string", value: ") && runtime.truthy(" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 340), _emit_expr206(_right310)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 341), _emit213(({ type: "string", value: ") })" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 340), runtime.opEq(_id262, ({ type: "string", value: "==" }))))) { -(runtime.info("compiler/emit_js.phi", 341), _emit_binary_op210(_s260, ({ type: "string", value: "opEq" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 342), runtime.opEq(_id262, ({ type: "string", value: "==" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 343), _emit_binary_op210(_s260, ({ type: "string", value: "opEq" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 342), runtime.opEq(_id262, ({ type: "string", value: "!=" }))))) { -(runtime.info("compiler/emit_js.phi", 343), _emit_binary_op210(_s260, ({ type: "string", value: "opNe" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 344), runtime.opEq(_id262, ({ type: "string", value: "!=" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 345), _emit_binary_op210(_s260, ({ type: "string", value: "opNe" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 344), runtime.opEq(_id262, ({ type: "string", value: "<" }))))) { -(runtime.info("compiler/emit_js.phi", 345), _emit_binary_op210(_s260, ({ type: "string", value: "opLt" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 346), runtime.opEq(_id262, ({ type: "string", value: "<" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 347), _emit_binary_op210(_s260, ({ type: "string", value: "opLt" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 346), runtime.opEq(_id262, ({ type: "string", value: ">" }))))) { -(runtime.info("compiler/emit_js.phi", 347), _emit_binary_op210(_s260, ({ type: "string", value: "opGt" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 348), runtime.opEq(_id262, ({ type: "string", value: ">" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 349), _emit_binary_op210(_s260, ({ type: "string", value: "opGt" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 348), runtime.opEq(_id262, ({ type: "string", value: "<=" }))))) { -(runtime.info("compiler/emit_js.phi", 349), _emit_binary_op210(_s260, ({ type: "string", value: "opLte" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 350), runtime.opEq(_id262, ({ type: "string", value: "<=" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 351), _emit_binary_op210(_s260, ({ type: "string", value: "opLte" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 350), runtime.opEq(_id262, ({ type: "string", value: ">=" }))))) { -(runtime.info("compiler/emit_js.phi", 351), _emit_binary_op210(_s260, ({ type: "string", value: "opGte" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 352), runtime.opEq(_id262, ({ type: "string", value: ">=" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 353), _emit_binary_op210(_s260, ({ type: "string", value: "opGte" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 352), runtime.opEq(_id262, ({ type: "string", value: "+" }))))) { -(runtime.info("compiler/emit_js.phi", 353), _emit_binary_op210(_s260, ({ type: "string", value: "opAdd" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 354), runtime.opEq(_id262, ({ type: "string", value: "+" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 355), _emit_binary_op210(_s260, ({ type: "string", value: "opAdd" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 354), runtime.opEq(_id262, ({ type: "string", value: "-" }))))) { -(runtime.info("compiler/emit_js.phi", 355), _emit_binary_op210(_s260, ({ type: "string", value: "opSub" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 356), runtime.opEq(_id262, ({ type: "string", value: "-" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 357), _emit_binary_op210(_s260, ({ type: "string", value: "opSub" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 356), runtime.opEq(_id262, ({ type: "string", value: "not" }))))) { -const r_230 = _s260; -const r_231 = r_230.values[0] ?? { type: "null"}; -const r_232 = r_230.values[1] ?? { type: "null"}; -let _expr310 = r_232; -(runtime.info("compiler/emit_js.phi", 358), _emit213(({ type: "string", value: "runtime.opNot(" }))); -(runtime.info("compiler/emit_js.phi", 359), _emit_expr206(_expr310)); -(runtime.info("compiler/emit_js.phi", 360), _emit213(({ type: "string", value: ")" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 358), runtime.opEq(_id262, ({ type: "string", value: "not" }))))) { +const r_231 = _s260; +const r_232 = r_231.values[0] ?? { type: "null"}; +const r_233 = r_231.values[1] ?? { type: "null"}; +let _expr311 = r_233; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 360), _emit213(({ type: "string", value: "runtime.opNot(" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 361), _emit_expr206(_expr311)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 362), _emit213(({ type: "string", value: ")" }))); } else { -const r_233 = _s260; -const r_234 = r_233.values[0] ?? { type: "null"}; -let _callee311 = r_234; -const r_235 = (runtime.info("compiler/emit_js.phi", 363), _slice37(_s260, ({ type: "int", value: 1 }))); -let _args312 = r_235; -(runtime.info("compiler/emit_js.phi", 364), _emit213((runtime.info("compiler/emit_js.phi", 364), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%, " }), (runtime.info("compiler/emit_js.phi", 364), _rt_info211(_line259)), _line259)))); -(runtime.info("compiler/emit_js.phi", 365), _emit_expr206(_callee311)); -(runtime.info("compiler/emit_js.phi", 366), _emit213(({ type: "string", value: "(" }))); -const r_236 = ({ type: "bool", value: true }); -let _first313 = r_236; -for (const r_237 of _args312.values) {; -let _arg314 = r_237; -if (runtime.truthy(runtime.opNot(_first313))) { -(runtime.info("compiler/emit_js.phi", 371), _emit213(({ type: "string", value: ", " }))); +const r_234 = _s260; +const r_235 = r_234.values[0] ?? { type: "null"}; +let _callee312 = r_235; +const r_236 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 365), _slice37(_s260, ({ type: "int", value: 1 }))); +let _args313 = r_236; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 366), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 366), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%, " }), (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 366), _rt_info211(_line259)), _line259)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 367), _emit_expr206(_callee312)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 368), _emit213(({ type: "string", value: "(" }))); +const r_237 = ({ type: "bool", value: true }); +let _first314 = r_237; +for (const r_238 of _args313.values) {; +let _arg315 = r_238; +if (runtime.truthy(runtime.opNot(_first314))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 373), _emit213(({ type: "string", value: ", " }))); }; -(_first313 = ({ type: "bool", value: false })); -(runtime.info("compiler/emit_js.phi", 375), _emit_expr206(_arg314)); +(_first314 = ({ type: "bool", value: false })); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 377), _emit_expr206(_arg315)); }; -(runtime.info("compiler/emit_js.phi", 378), _emit213(({ type: "string", value: "))" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 380), _emit213(({ type: "string", value: "))" }))); }}}}}}}}}}}}}}}}}}}}}}}}}; ; runtime.popCall(); return { type: "null" }; }; -function _emit_list_literal208(_s315) { -runtime.pushCall("emit_list_literal", "compiler/emit_js.phi"); -(runtime.info("compiler/emit_js.phi", 383), _emit213(({ type: "string", value: "({ type: \"list\", values: [" }))); -const r_238 = ({ type: "bool", value: true }); -let _first316 = r_238; -for (const r_239 of _s315.values) {; -let _e317 = r_239; -if (runtime.truthy(runtime.opNot(_first316))) { -(runtime.info("compiler/emit_js.phi", 387), _emit213(({ type: "string", value: ", " }))); +function _emit_list_literal208(_s316) { +runtime.pushCall("emit_list_literal", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 385), _emit213(({ type: "string", value: "({ type: \"list\", values: [" }))); +const r_239 = ({ type: "bool", value: true }); +let _first317 = r_239; +for (const r_240 of _s316.values) {; +let _e318 = r_240; +if (runtime.truthy(runtime.opNot(_first317))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 389), _emit213(({ type: "string", value: ", " }))); }; -(_first316 = ({ type: "bool", value: false })); -(runtime.info("compiler/emit_js.phi", 391), _emit_expr206(_e317)); +(_first317 = ({ type: "bool", value: false })); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 393), _emit_expr206(_e318)); }; -(runtime.info("compiler/emit_js.phi", 393), _emit213(({ type: "string", value: "] })" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 395), _emit213(({ type: "string", value: "] })" }))); ; runtime.popCall(); return { type: "null" }; }; -function _emit_let_node209(_pat318, _base_reg319) { -runtime.pushCall("emit_let_node", "compiler/emit_js.phi"); -const r_240 = _pat318; -const r_241 = r_240.values[0] ?? { type: "null"}; -let _pat_ty320 = r_241; -const r_242 = r_240.values[1] ?? { type: "null"}; -let _line321 = r_242; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 398), runtime.opEq(_pat_ty320, ({ type: "string", value: "ident" }))))) { -const r_243 = _pat318; -const r_244 = r_243.values[0] ?? { type: "null"}; -const r_245 = r_243.values[1] ?? { type: "null"}; -const r_246 = r_243.values[2] ?? { type: "null"}; -let _ident322 = r_246; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 401), runtime.opEq(_ident322, ({ type: "string", value: "_" }))))) { +function _emit_let_node209(_pat319, _base_reg320) { +runtime.pushCall("emit_let_node", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +const r_241 = _pat319; +const r_242 = r_241.values[0] ?? { type: "null"}; +let _pat_ty321 = r_242; +const r_243 = r_241.values[1] ?? { type: "null"}; +let _line322 = r_243; +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 400), runtime.opEq(_pat_ty321, ({ type: "string", value: "ident" }))))) { +const r_244 = _pat319; +const r_245 = r_244.values[0] ?? { type: "null"}; +const r_246 = r_244.values[1] ?? { type: "null"}; +const r_247 = r_244.values[2] ?? { type: "null"}; +let _ident323 = r_247; +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 403), runtime.opEq(_ident323, ({ type: "string", value: "_" }))))) { runtime.popCall(); return { type: "null" }}; -const r_247 = (runtime.info("compiler/emit_js.phi", 403), _define_let217(_ident322, _line321)); -let _sym_id323 = r_247; -(runtime.info("compiler/emit_js.phi", 404), _emit213((runtime.info("compiler/emit_js.phi", 404), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: ";\nlet _%% = r_%" }), _ident322, _sym_id323, _base_reg319)))); +const r_248 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 405), _define_let217(_ident323, _line322)); +let _sym_id324 = r_248; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 406), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 406), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: ";\nlet _%% = r_%" }), _ident323, _sym_id324, _base_reg320)))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 405), runtime.opEq(_pat_ty320, ({ type: "string", value: "list" }))))) { -const r_248 = _pat318; -const r_249 = r_248.values[0] ?? { type: "null"}; -const r_250 = r_248.values[1] ?? { type: "null"}; -const r_251 = r_248.values[2] ?? { type: "null"}; -let _pats324 = r_251; -const r_252 = ({ type: "int", value: 0 }); -let _i325 = r_252; -for (const r_253 of _pats324.values) {; -let _pat326 = r_253; -const r_254 = (runtime.info("compiler/emit_js.phi", 410), _let_node_reg_count229()); -let _reg327 = r_254; -(runtime.info("compiler/emit_js.phi", 411), _let_node_reg_increment230()); -(runtime.info("compiler/emit_js.phi", 412), _emit213((runtime.info("compiler/emit_js.phi", 412), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: ";\nconst r_% = r_%.values[%] ?? { type: \"null\"}" }), _reg327, _base_reg319, _i325)))); -(runtime.info("compiler/emit_js.phi", 416), _emit_let_node209(_pat326, _reg327)); -(_i325 = runtime.opAdd(_i325, ({ type: "int", value: 1 }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 407), runtime.opEq(_pat_ty321, ({ type: "string", value: "list" }))))) { +const r_249 = _pat319; +const r_250 = r_249.values[0] ?? { type: "null"}; +const r_251 = r_249.values[1] ?? { type: "null"}; +const r_252 = r_249.values[2] ?? { type: "null"}; +let _pats325 = r_252; +const r_253 = ({ type: "int", value: 0 }); +let _i326 = r_253; +for (const r_254 of _pats325.values) {; +let _pat327 = r_254; +const r_255 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 412), _let_node_reg_count229()); +let _reg328 = r_255; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 413), _let_node_reg_increment230()); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 414), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 414), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: ";\nconst r_% = r_%.values[%] ?? { type: \"null\"}" }), _reg328, _base_reg320, _i326)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 418), _emit_let_node209(_pat327, _reg328)); +(_i326 = runtime.opAdd(_i326, ({ type: "int", value: 1 }))); }; } else { -(runtime.info("compiler/emit_js.phi", 420), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "malformed pattern on line %" }), _line321)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 422), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "malformed pattern on line %" }), _line322)); }}; ; runtime.popCall(); return { type: "null" }; }; -function _emit_binary_op210(_s328, _id329) { -runtime.pushCall("emit_binary_op", "compiler/emit_js.phi"); -const r_255 = _s328; -const r_256 = r_255.values[0] ?? { type: "null"}; +function _emit_binary_op210(_s329, _id330) { +runtime.pushCall("emit_binary_op", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +const r_256 = _s329; const r_257 = r_256.values[0] ?? { type: "null"}; -const r_258 = r_256.values[1] ?? { type: "null"}; -let _line330 = r_258; -const r_259 = r_256.values[2] ?? { type: "null"}; -const r_260 = r_255.values[1] ?? { type: "null"}; -let _left331 = r_260; -const r_261 = r_255.values[2] ?? { type: "null"}; -let _right332 = r_261; -(runtime.info("compiler/emit_js.phi", 426), _emit213((runtime.info("compiler/emit_js.phi", 426), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%, runtime.%(" }), (runtime.info("compiler/emit_js.phi", 426), _rt_info211(_line330)), _id329)))); -(runtime.info("compiler/emit_js.phi", 427), _emit_expr206(_left331)); -(runtime.info("compiler/emit_js.phi", 428), _emit213(({ type: "string", value: ", " }))); -(runtime.info("compiler/emit_js.phi", 429), _emit_expr206(_right332)); -(runtime.info("compiler/emit_js.phi", 430), _emit213(({ type: "string", value: "))" }))); +const r_258 = r_257.values[0] ?? { type: "null"}; +const r_259 = r_257.values[1] ?? { type: "null"}; +let _line331 = r_259; +const r_260 = r_257.values[2] ?? { type: "null"}; +const r_261 = r_256.values[1] ?? { type: "null"}; +let _left332 = r_261; +const r_262 = r_256.values[2] ?? { type: "null"}; +let _right333 = r_262; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 428), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 428), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%, runtime.%(" }), (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 428), _rt_info211(_line331)), _id330)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 429), _emit_expr206(_left332)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 430), _emit213(({ type: "string", value: ", " }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 431), _emit_expr206(_right333)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 432), _emit213(({ type: "string", value: "))" }))); ; runtime.popCall(); return { type: "null" }; }; -function _rt_info211(_line333) { -runtime.pushCall("rt_info", "compiler/emit_js.phi"); +function _rt_info211(_line334) { +runtime.pushCall("rt_info", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); runtime.popCall(); -return (runtime.info("compiler/emit_js.phi", 434), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.info(\"%\", %)" }), _filename225, _line333)); +return (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 436), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.info(\"%\", %)" }), _filename225, _line334)); ; runtime.popCall(); return { type: "null" }; }; -function _emit_assign_expr212(_s334, _line335, _id336) { -runtime.pushCall("emit_assign_expr", "compiler/emit_js.phi"); -const r_262 = _s334; -const r_263 = r_262.values[0] ?? { type: "null"}; -const r_264 = r_262.values[1] ?? { type: "null"}; -const r_265 = r_264.values[0] ?? { type: "null"}; -let _target_type337 = r_265; -const r_266 = r_262.values[2] ?? { type: "null"}; -let _expr338 = r_266; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 439), runtime.opNe(_target_type337, ({ type: "string", value: "ident" }))))) { -(runtime.info("compiler/emit_js.phi", 440), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "cannot assign to expression on line %" }), _line335)); +function _emit_assign_expr212(_s335, _line336, _id337) { +runtime.pushCall("emit_assign_expr", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +const r_263 = _s335; +const r_264 = r_263.values[0] ?? { type: "null"}; +const r_265 = r_263.values[1] ?? { type: "null"}; +const r_266 = r_265.values[0] ?? { type: "null"}; +let _target_type338 = r_266; +const r_267 = r_263.values[2] ?? { type: "null"}; +let _expr339 = r_267; +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 441), runtime.opNe(_target_type338, ({ type: "string", value: "ident" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 442), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "cannot assign to expression on line %" }), _line336)); }; -const r_267 = _s334; -const r_268 = r_267.values[0] ?? { type: "null"}; -const r_269 = r_267.values[1] ?? { type: "null"}; -const r_270 = r_269.values[0] ?? { type: "null"}; -const r_271 = r_269.values[1] ?? { type: "null"}; -const r_272 = r_269.values[2] ?? { type: "null"}; -let _ident339 = r_272; -const r_273 = (runtime.info("compiler/emit_js.phi", 443), _get_sym221(_ident339)); -let _sym340 = r_273; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 444), runtime.opEq(_sym340, ({ type: "null" }))))) { -(runtime.info("compiler/emit_js.phi", 445), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "could not find symbol '%' on line %" }), _ident339, _line335)); +const r_268 = _s335; +const r_269 = r_268.values[0] ?? { type: "null"}; +const r_270 = r_268.values[1] ?? { type: "null"}; +const r_271 = r_270.values[0] ?? { type: "null"}; +const r_272 = r_270.values[1] ?? { type: "null"}; +const r_273 = r_270.values[2] ?? { type: "null"}; +let _ident340 = r_273; +const r_274 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 445), _get_sym221(_ident340)); +let _sym341 = r_274; +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 446), runtime.opEq(_sym341, ({ type: "null" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 447), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "could not find symbol '%' on line %" }), _ident340, _line336)); }; -const r_274 = _sym340; -const r_275 = r_274.values[0] ?? { type: "null"}; -let _sym_id341 = r_275; -const r_276 = r_274.values[1] ?? { type: "null"}; -let _sym_type342 = r_276; -const r_277 = r_274.values[2] ?? { type: "null"}; -let _sym_ident343 = r_277; -const r_278 = r_274.values[3] ?? { type: "null"}; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 448), runtime.opEq(_sym_type342, ({ type: "string", value: "let" }))))) { -(runtime.info("compiler/emit_js.phi", 449), _emit213((runtime.info("compiler/emit_js.phi", 449), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(_%% = " }), _sym_ident343, _sym_id341)))); -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 450), runtime.opEq(_id336, ({ type: "string", value: "=" }))))) { -(runtime.info("compiler/emit_js.phi", 451), _emit_expr206(_expr338)); +const r_275 = _sym341; +const r_276 = r_275.values[0] ?? { type: "null"}; +let _sym_id342 = r_276; +const r_277 = r_275.values[1] ?? { type: "null"}; +let _sym_type343 = r_277; +const r_278 = r_275.values[2] ?? { type: "null"}; +let _sym_ident344 = r_278; +const r_279 = r_275.values[3] ?? { type: "null"}; +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 450), runtime.opEq(_sym_type343, ({ type: "string", value: "let" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 451), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 451), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(_%% = " }), _sym_ident344, _sym_id342)))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 452), runtime.opEq(_id337, ({ type: "string", value: "=" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 453), _emit_expr206(_expr339)); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 452), runtime.opEq(_id336, ({ type: "string", value: "+" }))))) { -(runtime.info("compiler/emit_js.phi", 453), _emit213((runtime.info("compiler/emit_js.phi", 453), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.opAdd(_%%, " }), _sym_ident343, _sym_id341)))); -(runtime.info("compiler/emit_js.phi", 454), _emit_expr206(_expr338)); -(runtime.info("compiler/emit_js.phi", 455), _emit213(({ type: "string", value: ")" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 454), runtime.opEq(_id337, ({ type: "string", value: "+" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 455), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 455), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.opAdd(_%%, " }), _sym_ident344, _sym_id342)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 456), _emit_expr206(_expr339)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 457), _emit213(({ type: "string", value: ")" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 456), runtime.opEq(_id336, ({ type: "string", value: "-" }))))) { -(runtime.info("compiler/emit_js.phi", 457), _emit213((runtime.info("compiler/emit_js.phi", 457), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.opSub(_%%, " }), _sym_ident343, _sym_id341)))); -(runtime.info("compiler/emit_js.phi", 458), _emit_expr206(_expr338)); -(runtime.info("compiler/emit_js.phi", 459), _emit213(({ type: "string", value: ")" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 458), runtime.opEq(_id337, ({ type: "string", value: "-" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 459), _emit213((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 459), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.opSub(_%%, " }), _sym_ident344, _sym_id342)))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 460), _emit_expr206(_expr339)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 461), _emit213(({ type: "string", value: ")" }))); } else { -(runtime.info("compiler/emit_js.phi", 461), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "not implemented" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 463), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "not implemented" }))); }}}; -(runtime.info("compiler/emit_js.phi", 463), _emit213(({ type: "string", value: ")" }))); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 465), _emit213(({ type: "string", value: ")" }))); } else { -(runtime.info("compiler/emit_js.phi", 465), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "cannot assign to symbol '%' on line %" }), _sym_ident343, _line335)); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 467), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "cannot assign to symbol '%' on line %" }), _sym_ident344, _line336)); }; ; runtime.popCall(); return { type: "null" }; }; -function _emit213(_str344) { -runtime.pushCall("emit", "compiler/emit_js.phi"); -(runtime.info("compiler/emit_js.phi", 470), ((...args) => runtime.builtinPush(...args))(_output224, _str344)); +function _emit213(_str345) { +runtime.pushCall("emit", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 472), ((...args) => runtime.builtinPush(...args))(_output224, _str345)); ; runtime.popCall(); return { type: "null" }; }; -function _define_builtin214(_ident345, _builtin_id346) { -runtime.pushCall("define_builtin", "compiler/emit_js.phi"); -const r_279 = (runtime.info("compiler/emit_js.phi", 474), _sym_id_count227()); -let _sym_id347 = r_279; -(runtime.info("compiler/emit_js.phi", 475), _sym_id_increment228()); -(runtime.info("compiler/emit_js.phi", 477), _define_sym220(_ident345, ({ type: "list", values: [_sym_id347, ({ type: "string", value: "builtin" }), _builtin_id346] }))); +function _define_builtin214(_ident346, _builtin_id347) { +runtime.pushCall("define_builtin", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +const r_280 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 476), _sym_id_count227()); +let _sym_id348 = r_280; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 477), _sym_id_increment228()); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 479), _define_sym220(_ident346, ({ type: "list", values: [_sym_id348, ({ type: "string", value: "builtin" }), _builtin_id347] }))); runtime.popCall(); -return _sym_id347; +return _sym_id348; ; runtime.popCall(); return { type: "null" }; }; -function _define_fn215(_ident348, _line349) { -runtime.pushCall("define_fn", "compiler/emit_js.phi"); -const r_280 = (runtime.info("compiler/emit_js.phi", 482), _sym_id_count227()); -let _sym_id350 = r_280; -(runtime.info("compiler/emit_js.phi", 483), _sym_id_increment228()); -(runtime.info("compiler/emit_js.phi", 485), _define_sym220(_ident348, ({ type: "list", values: [_sym_id350, ({ type: "string", value: "fn" }), _ident348, _line349] }))); +function _define_fn215(_ident349, _line350) { +runtime.pushCall("define_fn", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +const r_281 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 484), _sym_id_count227()); +let _sym_id351 = r_281; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 485), _sym_id_increment228()); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 487), _define_sym220(_ident349, ({ type: "list", values: [_sym_id351, ({ type: "string", value: "fn" }), _ident349, _line350] }))); runtime.popCall(); -return _sym_id350; +return _sym_id351; ; runtime.popCall(); return { type: "null" }; }; -function _define_param216(_ident351, _line352) { -runtime.pushCall("define_param", "compiler/emit_js.phi"); -const r_281 = (runtime.info("compiler/emit_js.phi", 490), _sym_id_count227()); -let _sym_id353 = r_281; -(runtime.info("compiler/emit_js.phi", 491), _sym_id_increment228()); -(runtime.info("compiler/emit_js.phi", 493), _define_sym220(_ident351, ({ type: "list", values: [_sym_id353, ({ type: "string", value: "param" }), _ident351, _line352] }))); +function _define_param216(_ident352, _line353) { +runtime.pushCall("define_param", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +const r_282 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 492), _sym_id_count227()); +let _sym_id354 = r_282; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 493), _sym_id_increment228()); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 495), _define_sym220(_ident352, ({ type: "list", values: [_sym_id354, ({ type: "string", value: "param" }), _ident352, _line353] }))); runtime.popCall(); -return _sym_id353; +return _sym_id354; ; runtime.popCall(); return { type: "null" }; }; -function _define_let217(_ident354, _line355) { -runtime.pushCall("define_let", "compiler/emit_js.phi"); -const r_282 = (runtime.info("compiler/emit_js.phi", 498), _sym_id_count227()); -let _sym_id356 = r_282; -(runtime.info("compiler/emit_js.phi", 499), _sym_id_increment228()); -(runtime.info("compiler/emit_js.phi", 501), _define_sym220(_ident354, ({ type: "list", values: [_sym_id356, ({ type: "string", value: "let" }), _ident354, _line355] }))); +function _define_let217(_ident355, _line356) { +runtime.pushCall("define_let", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +const r_283 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 500), _sym_id_count227()); +let _sym_id357 = r_283; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 501), _sym_id_increment228()); +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 503), _define_sym220(_ident355, ({ type: "list", values: [_sym_id357, ({ type: "string", value: "let" }), _ident355, _line356] }))); runtime.popCall(); -return _sym_id356; +return _sym_id357; ; runtime.popCall(); return { type: "null" }; }; function _enter_scope218() { -runtime.pushCall("enter_scope", "compiler/emit_js.phi"); -const r_283 = _syms226; -const r_284 = r_283.values[0] ?? { type: "null"}; -let _enter_scope357 = r_284; -(runtime.info("compiler/emit_js.phi", 508), _enter_scope357()); +runtime.pushCall("enter_scope", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +const r_284 = _syms226; +const r_285 = r_284.values[0] ?? { type: "null"}; +let _enter_scope358 = r_285; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 510), _enter_scope358()); ; runtime.popCall(); return { type: "null" }; }; function _leave_scope219() { -runtime.pushCall("leave_scope", "compiler/emit_js.phi"); -const r_285 = _syms226; -const r_286 = r_285.values[0] ?? { type: "null"}; -const r_287 = r_285.values[1] ?? { type: "null"}; -let _leave_scope358 = r_287; -(runtime.info("compiler/emit_js.phi", 512), _leave_scope358()); +runtime.pushCall("leave_scope", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +const r_286 = _syms226; +const r_287 = r_286.values[0] ?? { type: "null"}; +const r_288 = r_286.values[1] ?? { type: "null"}; +let _leave_scope359 = r_288; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 514), _leave_scope359()); ; runtime.popCall(); return { type: "null" }; }; -function _define_sym220(_ident359, _sym360) { -runtime.pushCall("define_sym", "compiler/emit_js.phi"); -const r_288 = _syms226; -const r_289 = r_288.values[0] ?? { type: "null"}; -const r_290 = r_288.values[1] ?? { type: "null"}; -const r_291 = r_288.values[2] ?? { type: "null"}; -let _define_sym361 = r_291; +function _define_sym220(_ident360, _sym361) { +runtime.pushCall("define_sym", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +const r_289 = _syms226; +const r_290 = r_289.values[0] ?? { type: "null"}; +const r_291 = r_289.values[1] ?? { type: "null"}; +const r_292 = r_289.values[2] ?? { type: "null"}; +let _define_sym362 = r_292; runtime.popCall(); -return (runtime.info("compiler/emit_js.phi", 516), _define_sym361(_ident359, _sym360)); +return (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 518), _define_sym362(_ident360, _sym361)); ; runtime.popCall(); return { type: "null" }; }; -function _get_sym221(_ident362) { -runtime.pushCall("get_sym", "compiler/emit_js.phi"); -const r_292 = _syms226; -const r_293 = r_292.values[0] ?? { type: "null"}; -const r_294 = r_292.values[1] ?? { type: "null"}; -const r_295 = r_292.values[2] ?? { type: "null"}; -const r_296 = r_292.values[3] ?? { type: "null"}; -let _get_sym363 = r_296; +function _get_sym221(_ident363) { +runtime.pushCall("get_sym", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +const r_293 = _syms226; +const r_294 = r_293.values[0] ?? { type: "null"}; +const r_295 = r_293.values[1] ?? { type: "null"}; +const r_296 = r_293.values[2] ?? { type: "null"}; +const r_297 = r_293.values[3] ?? { type: "null"}; +let _get_sym364 = r_297; runtime.popCall(); -return (runtime.info("compiler/emit_js.phi", 520), _get_sym363(_ident362)); +return (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 522), _get_sym364(_ident363)); ; runtime.popCall(); return { type: "null" }; }; function _get_current_map222() { -runtime.pushCall("get_current_map", "compiler/emit_js.phi"); -const r_297 = _syms226; -const r_298 = r_297.values[0] ?? { type: "null"}; -const r_299 = r_297.values[1] ?? { type: "null"}; -const r_300 = r_297.values[2] ?? { type: "null"}; -const r_301 = r_297.values[3] ?? { type: "null"}; -const r_302 = r_297.values[4] ?? { type: "null"}; -let _get_current_map364 = r_302; +runtime.pushCall("get_current_map", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +const r_298 = _syms226; +const r_299 = r_298.values[0] ?? { type: "null"}; +const r_300 = r_298.values[1] ?? { type: "null"}; +const r_301 = r_298.values[2] ?? { type: "null"}; +const r_302 = r_298.values[3] ?? { type: "null"}; +const r_303 = r_298.values[4] ?? { type: "null"}; +let _get_current_map365 = r_303; runtime.popCall(); -return (runtime.info("compiler/emit_js.phi", 524), _get_current_map364()); +return (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 526), _get_current_map365()); ; runtime.popCall(); return { type: "null" }; }; function _print_syms223() { -runtime.pushCall("print_syms", "compiler/emit_js.phi"); -const r_303 = _syms226; -const r_304 = r_303.values[0] ?? { type: "null"}; -const r_305 = r_303.values[1] ?? { type: "null"}; -const r_306 = r_303.values[2] ?? { type: "null"}; -const r_307 = r_303.values[3] ?? { type: "null"}; -const r_308 = r_303.values[4] ?? { type: "null"}; -const r_309 = r_303.values[5] ?? { type: "null"}; -let _print_syms365 = r_309; -(runtime.info("compiler/emit_js.phi", 528), _print_syms365()); +runtime.pushCall("print_syms", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +const r_304 = _syms226; +const r_305 = r_304.values[0] ?? { type: "null"}; +const r_306 = r_304.values[1] ?? { type: "null"}; +const r_307 = r_304.values[2] ?? { type: "null"}; +const r_308 = r_304.values[3] ?? { type: "null"}; +const r_309 = r_304.values[4] ?? { type: "null"}; +const r_310 = r_304.values[5] ?? { type: "null"}; +let _print_syms366 = r_310; +(runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 530), _print_syms366()); ; runtime.popCall(); return { type: "null" }; @@ -1415,120 +1417,124 @@ runtime.popCall(); return { type: "null" }; }; function _Counter155() { -runtime.pushCall("Counter", "compiler/emit_js.phi"); -const r_310 = ({ type: "int", value: 0 }); -let _counter368 = r_310; -function _count366() { -runtime.pushCall("count", "compiler/emit_js.phi"); +runtime.pushCall("Counter", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +const r_311 = ({ type: "int", value: 0 }); +let _counter369 = r_311; +function _count367() { +runtime.pushCall("count", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); runtime.popCall(); -return _counter368; +return _counter369; ; runtime.popCall(); return { type: "null" }; }; -function _increment367() { -runtime.pushCall("increment", "compiler/emit_js.phi"); -(_counter368 = runtime.opAdd(_counter368, ({ type: "int", value: 1 }))); +function _increment368() { +runtime.pushCall("increment", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +(_counter369 = runtime.opAdd(_counter369, ({ type: "int", value: 1 }))); ; runtime.popCall(); return { type: "null" }; }; runtime.popCall(); -return ({ type: "list", values: [_count366, _increment367] }); +return ({ type: "list", values: [_count367, _increment368] }); ; runtime.popCall(); return { type: "null" }; }; -function _string_escape156(_str369) { -runtime.pushCall("string_escape", "compiler/emit_js.phi"); -const r_311 = (runtime.info("compiler/emit_js.phi", 549), ((...args) => runtime.builtinLen(...args))(_str369)); -let _str_len370 = r_311; -const r_312 = ({ type: "int", value: 0 }); -let _i371 = r_312; -const r_313 = ({ type: "string", value: "" }); -let _result372 = r_313; +function _string_escape156(_str370) { +runtime.pushCall("string_escape", "/home/simone/Workspace/phi-lang/compiler/emit_js.phi"); +const r_312 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 551), ((...args) => runtime.builtinLen(...args))(_str370)); +let _str_len371 = r_312; +const r_313 = ({ type: "int", value: 0 }); +let _i372 = r_313; +const r_314 = ({ type: "string", value: "" }); +let _result373 = r_314; while (true) { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 553), runtime.opGte(_i371, _str_len370)))) { +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 555), runtime.opGte(_i372, _str_len371)))) { break}; -const r_314 = (runtime.info("compiler/emit_js.phi", 554), ((...args) => runtime.builtinAt(...args))(_str369, _i371)); -let _ch373 = r_314; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 555), runtime.opEq(_ch373, ({ type: "string", value: "\\" }))))) { -(_result372 = runtime.opAdd(_result372, ({ type: "string", value: "\\\\" }))); +const r_315 = (runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 556), ((...args) => runtime.builtinAt(...args))(_str370, _i372)); +let _ch374 = r_315; +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 557), runtime.opEq(_ch374, ({ type: "string", value: "\\" }))))) { +(_result373 = runtime.opAdd(_result373, ({ type: "string", value: "\\\\" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 557), runtime.opEq(_ch373, ({ type: "string", value: "\"" }))))) { -(_result372 = runtime.opAdd(_result372, ({ type: "string", value: "\\\"" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 559), runtime.opEq(_ch374, ({ type: "string", value: "\"" }))))) { +(_result373 = runtime.opAdd(_result373, ({ type: "string", value: "\\\"" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 559), runtime.opEq(_ch373, ({ type: "string", value: "\t" }))))) { -(_result372 = runtime.opAdd(_result372, ({ type: "string", value: "\\t" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 561), runtime.opEq(_ch374, ({ type: "string", value: "\t" }))))) { +(_result373 = runtime.opAdd(_result373, ({ type: "string", value: "\\t" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 561), runtime.opEq(_ch373, ({ type: "string", value: "\r" }))))) { -(_result372 = runtime.opAdd(_result372, ({ type: "string", value: "\\r" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 563), runtime.opEq(_ch374, ({ type: "string", value: "\r" }))))) { +(_result373 = runtime.opAdd(_result373, ({ type: "string", value: "\\r" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 563), runtime.opEq(_ch373, ({ type: "string", value: "\n" }))))) { -(_result372 = runtime.opAdd(_result372, ({ type: "string", value: "\\n" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 565), runtime.opEq(_ch374, ({ type: "string", value: "\n" }))))) { +(_result373 = runtime.opAdd(_result373, ({ type: "string", value: "\\n" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 565), runtime.opEq(_ch373, ({ type: "string", value: "\n" }))))) { -(_result372 = runtime.opAdd(_result372, ({ type: "string", value: "\\0" }))); +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compiler/emit_js.phi", 567), runtime.opEq(_ch374, ({ type: "string", value: "\n" }))))) { +(_result373 = runtime.opAdd(_result373, ({ type: "string", value: "\\0" }))); } else { -(_result372 = runtime.opAdd(_result372, _ch373)); +(_result373 = runtime.opAdd(_result373, _ch374)); }}}}}}; -(_i371 = runtime.opAdd(_i371, ({ type: "int", value: 1 }))); +(_i372 = runtime.opAdd(_i372, ({ type: "int", value: 1 }))); }; runtime.popCall(); -return _result372; +return _result373; ; runtime.popCall(); return { type: "null" }; }; -// === resuming file compile.phi === -runtime.setFile("compile.phi"); -function _print_expr18(_expr374, _depth375) { -runtime.pushCall("print_expr", "compile.phi"); -const r_315 = _expr374; -const r_316 = r_315.values[0] ?? { type: "null"}; -let _ty376 = r_316; -const r_317 = r_315.values[1] ?? { type: "null"}; -let _line377 = r_317; -const r_318 = r_315.values[2] ?? { type: "null"}; -let _value378 = r_318; -if (runtime.truthy((runtime.info("compile.phi", 7), runtime.opEq(_ty376, ({ type: "string", value: "list" }))))) { -(runtime.info("compile.phi", 8), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "%(% %" }), (runtime.info("compile.phi", 8), _indent40(_depth375)), _ty376, _line377)); -for (const r_319 of _value378.values) {; -let _e379 = r_319; -(runtime.info("compile.phi", 10), _print_expr18(_e379, (runtime.info("compile.phi", 10), runtime.opAdd(_depth375, ({ type: "int", value: 1 }))))); +// === resuming file /home/simone/Workspace/phi-lang/compile.phi === +runtime.setFile("/home/simone/Workspace/phi-lang/compile.phi"); +function _print_expr18(_expr375, _depth376) { +runtime.pushCall("print_expr", "/home/simone/Workspace/phi-lang/compile.phi"); +const r_316 = _expr375; +const r_317 = r_316.values[0] ?? { type: "null"}; +let _ty377 = r_317; +const r_318 = r_316.values[1] ?? { type: "null"}; +let _line378 = r_318; +const r_319 = r_316.values[2] ?? { type: "null"}; +let _value379 = r_319; +if (runtime.truthy((runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 7), runtime.opEq(_ty377, ({ type: "string", value: "list" }))))) { +(runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 8), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "%(% %" }), (runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 8), _indent40(_depth376)), _ty377, _line378)); +for (const r_320 of _value379.values) {; +let _e380 = r_320; +(runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 10), _print_expr18(_e380, (runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 10), runtime.opAdd(_depth376, ({ type: "int", value: 1 }))))); }; -(runtime.info("compile.phi", 12), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "%)" }), (runtime.info("compile.phi", 12), _indent40(_depth375)))); +(runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 12), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "%)" }), (runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 12), _indent40(_depth376)))); } else { -(runtime.info("compile.phi", 14), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "%%" }), (runtime.info("compile.phi", 14), _indent40(_depth375)), _expr374)); +(runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 14), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "%%" }), (runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 14), _indent40(_depth376)), _expr375)); }; ; runtime.popCall(); return { type: "null" }; }; -const r_320 = (runtime.info("compile.phi", 18), ((...args) => runtime.builtinGetArgs(...args))()); -const r_321 = r_320.values[0] ?? { type: "null"}; -let _input_filename380 = r_321; -const r_322 = r_320.values[1] ?? { type: "null"}; -let _output_filename381 = r_322; -(runtime.info("compile.phi", 20), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "compiling '%'..." }), _input_filename380)); -const r_323 = (runtime.info("compile.phi", 21), ((...args) => runtime.builtinReadTextFile(...args))(_input_filename380)); -let _text382 = r_323; -const r_324 = (runtime.info("compile.phi", 23), _tokenize107(_text382)); -let _tokens383 = r_324; -const r_325 = (runtime.info("compile.phi", 24), _Parser106(_tokens383)); -let _parser384 = r_325; -const r_326 = _parser384; -const r_327 = r_326.values[0] ?? { type: "null"}; -let _parse385 = r_327; -const r_328 = (runtime.info("compile.phi", 26), _parse385()); -let _ast386 = r_328; -const r_329 = (runtime.info("compile.phi", 27), _JsEmitter154(_ast386, _input_filename380)); -let _emitter387 = r_329; -const r_330 = _emitter387; -const r_331 = r_330.values[0] ?? { type: "null"}; -let _emit388 = r_331; -const r_332 = (runtime.info("compile.phi", 29), _emit388()); -let _js_code389 = r_332; -(runtime.info("compile.phi", 34), ((...args) => runtime.builtinWriteTextFile(...args))(_output_filename381, _js_code389)); -(runtime.info("compile.phi", 35), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "writing '%'" }), _output_filename381)); +const r_321 = (runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 18), ((...args) => runtime.builtinGetArgs(...args))()); +const r_322 = r_321.values[0] ?? { type: "null"}; +let _input_filename_rel381 = r_322; +const r_323 = r_321.values[1] ?? { type: "null"}; +let _output_filename_rel382 = r_323; +const r_324 = (runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 20), ((...args) => runtime.builtinFsResolve(...args))((runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 20), ((...args) => runtime.builtinFsCwd(...args))()), _input_filename_rel381)); +let _input_filename383 = r_324; +const r_325 = (runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 21), ((...args) => runtime.builtinFsResolve(...args))((runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 21), ((...args) => runtime.builtinFsCwd(...args))()), _output_filename_rel382)); +let _output_filename384 = r_325; +(runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 23), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "compiling '%'..." }), _input_filename383)); +const r_326 = (runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 24), ((...args) => runtime.builtinReadTextFile(...args))(_input_filename383)); +let _text385 = r_326; +const r_327 = (runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 26), _tokenize107(_text385)); +let _tokens386 = r_327; +const r_328 = (runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 27), _Parser106(_tokens386)); +let _parser387 = r_328; +const r_329 = _parser387; +const r_330 = r_329.values[0] ?? { type: "null"}; +let _parse388 = r_330; +const r_331 = (runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 29), _parse388()); +let _ast389 = r_331; +const r_332 = (runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 30), _JsEmitter154(_ast389, _input_filename383)); +let _emitter390 = r_332; +const r_333 = _emitter390; +const r_334 = r_333.values[0] ?? { type: "null"}; +let _emit391 = r_334; +const r_335 = (runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 32), _emit391()); +let _js_code392 = r_335; +(runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 37), ((...args) => runtime.builtinWriteTextFile(...args))(_output_filename384, _js_code392)); +(runtime.info("/home/simone/Workspace/phi-lang/compile.phi", 38), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "writing '%'" }), _output_filename384));