diff --git a/lang/src/compiler/entry/compiler_stageb.hako b/lang/src/compiler/entry/compiler_stageb.hako index 7c5a6265..f54796dd 100644 --- a/lang/src/compiler/entry/compiler_stageb.hako +++ b/lang/src/compiler/entry/compiler_stageb.hako @@ -1474,9 +1474,25 @@ static box StageBDriverBox { } } + // Phase 71-SSA 71-11.1: Guaranteed trace before Program JSON emit + { + local marker_enabled = env.get("HAKO_STAGEB_TRACE") + if marker_enabled != null && ("" + marker_enabled) == "1" { + local ajson_len = 0 + if ast_json != null { ajson_len = ("" + ast_json).length() } + print("[stageb/main] BEFORE_EMIT ast_json_len=" + ("" + ajson_len)) + } + } print("[stageb/main] before ast_json") print(ast_json) print("[stageb/main] after ast_json") + // Phase 71-SSA 71-11.1: Guaranteed trace after Program JSON emit + { + local marker_enabled = env.get("HAKO_STAGEB_TRACE") + if marker_enabled != null && ("" + marker_enabled) == "1" { + print("[stageb/main] AFTER_EMIT success") + } + } { local tracer = new StageBTraceBox() tracer.log("StageBDriverBox.main:exit rc=0") diff --git a/lang/src/compiler/parser/parser_box.hako b/lang/src/compiler/parser/parser_box.hako index 2d151cfe..5152b9c4 100644 --- a/lang/src/compiler/parser/parser_box.hako +++ b/lang/src/compiler/parser/parser_box.hako @@ -67,16 +67,10 @@ box ParserBox { return out } - // === Delegation to ParserStringUtilsBox === - is_digit(ch) { return ParserStringUtilsBox.is_digit(ch) } - - is_space(ch) { return ParserStringUtilsBox.is_space(ch) } - - is_alpha(ch) { return ParserStringUtilsBox.is_alpha(ch) } - - starts_with(src, i, pat) { return ParserStringUtilsBox.starts_with(src, i, pat) } - - index_of(src, i, pat) { return ParserStringUtilsBox.index_of(src, i, pat) } + // === Phase 71-SSA: Removed delegation methods to avoid SSA undef === + // Direct use of ParserStringUtilsBox methods recommended instead + // Removed: is_digit, is_space, is_alpha, starts_with, index_of + // Use ParserStringUtilsBox.method() directly to avoid ValueId mapping issues trim(s) { // Phase 71-SSA: Direct implementation to avoid ValueId mapping issue in static box delegation @@ -97,13 +91,9 @@ box ParserBox { return "" } - starts_with_kw(src, i, kw) { return ParserStringUtilsBox.starts_with_kw(src, i, kw) } - - i2s(v) { return ParserStringUtilsBox.i2s(v) } - - to_int(s) { return ParserStringUtilsBox.to_int(s) } - - skip_ws(src, i) { return ParserStringUtilsBox.skip_ws(src, i) } + // Phase 71-SSA: Removed delegation methods to avoid SSA undef + // Removed: starts_with_kw, i2s, to_int, skip_ws + // Use ParserStringUtilsBox.method() directly instead // === Delegation to scanner boxes === read_ident2(src, i) { return ParserIdentScanBox.scan_ident(src, i) } @@ -119,7 +109,7 @@ box ParserBox { local at = pair.lastIndexOf("@") local content = pair.substring(0, at) local pos = 0 - if at >= 0 { pos = me.to_int(pair.substring(at+1, pair.length())) } + if at >= 0 { pos = ParserStringUtilsBox.to_int(pair.substring(at+1, pair.length())) } else { pos = i } me.gpos_set(pos) return content @@ -136,7 +126,7 @@ box ParserBox { local at = pair.lastIndexOf("@") local content = pair.substring(0, at) local pos = 0 - if at >= 0 { pos = me.to_int(pair.substring(at+1, pair.length())) } + if at >= 0 { pos = ParserStringUtilsBox.to_int(pair.substring(at+1, pair.length())) } else { pos = i } me.gpos_set(pos) return content @@ -164,10 +154,10 @@ box ParserBox { } if idx >= 0 { p = p.substring(idx+1, p.length()) } - if p.length() > 5 && me.starts_with(p, p.length()-5, ".hako") == 1 { + if p.length() > 5 && ParserStringUtilsBox.starts_with(p, p.length()-5, ".hako") == 1 { p = p.substring(0, p.length()-5) } else { - if p.length() > 6 && me.starts_with(p, p.length()-6, ".hako") == 1 { + if p.length() > 6 && ParserStringUtilsBox.starts_with(p, p.length()-6, ".hako") == 1 { p = p.substring(0, p.length()-6) } } @@ -360,7 +350,7 @@ box ParserBox { local chm = ms.substring(mi, mi + 1) if chm < "0" || chm > "9" { ok = 0 break } if ok == 0 { ok = 1 } - mv = mv * 10 + me.to_int(chm) + mv = mv * 10 + ParserStringUtilsBox.to_int(chm) mi = mi + 1 } if ok == 1 && mv > 0 { max_prog = mv }