feat(stage-b): Add FLOW keyword support + fix Stage-3 keyword conflicts
## ✅ Fixed Issues ### 1. `local` keyword tokenization (commit 9aab64f7) - Added Stage-3 gate for LOCAL/TRY/CATCH/THROW keywords - LOCAL now only active when NYASH_PARSER_STAGE3=1 ### 2. `env.local.get` keyword conflict - File: `lang/src/compiler/entry/compiler_stageb.hako:21-23` - Problem: `.local` in member access tokenized as `.LOCAL` keyword - Fix: Commented out `env.local.get("HAKO_SOURCE")` line - Fallback: Use `--source` argument (still functional) ### 3. `flow` keyword missing - Added FLOW to TokenType enum (`src/tokenizer/kinds.rs`) - Added "flow" → TokenType::FLOW mapping (`src/tokenizer/lex_ident.rs`) - Added FLOW to Stage-3 gate (requires NYASH_PARSER_STAGE3=1) - Added FLOW to parser statement dispatch (`src/parser/statements/mod.rs`) - Added FLOW to declaration handler (`src/parser/statements/declarations.rs`) - Updated box_declaration parser to accept BOX or FLOW (`src/parser/declarations/box_definition.rs`) - Treat `flow FooBox {}` as syntactic sugar for `box FooBox {}` ### 4. Module namespace conversion - Renamed `lang.compiler.builder.ssa.local` → `localvar` (avoid keyword) - Renamed file `local.hako` → `local_ssa.hako` - Converted 152 path-based using statements to namespace format - Added 26+ entries to `nyash.toml` [modules] section ## ⚠️ Remaining Issues ### Stage-B selfhost compiler performance - Stage-B compiler not producing output (hangs/times out after 10+ seconds) - Excessive PHI debug output suggests compilation loop issue - Needs investigation: infinite loop or N² algorithm in hako compiler ### Fallback JSON version mismatch - Rust fallback (`--emit-mir-json`) emits MIR v1 JSON (schema_version: "1.0") - Smoke tests expect MIR v0 JSON (`"version":0, "kind":"Program"`) - stageb_helpers.sh fallback needs adjustment ## Test Status - Parse errors: FIXED ✅ - Keyword conflicts: FIXED ✅ - Stage-B smoke tests: STILL FAILING ❌ (performance issue) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
47
nyash.toml
47
nyash.toml
@ -72,12 +72,52 @@ path = "lang/src/shared/common/string_helpers.hako"
|
||||
"lang.compiler.stage1.emitter_box" = "lang/src/compiler/stage1/emitter_box.hako"
|
||||
"lang.compiler.pipeline_v2.flow_entry" = "lang/src/compiler/pipeline_v2/flow_entry.hako"
|
||||
"lang.compiler.pipeline_v2.pipeline" = "lang/src/compiler/pipeline_v2/pipeline.hako"
|
||||
"lang.compiler.pipeline_v2.stage1_extract_flow" = "lang/src/compiler/pipeline_v2/stage1_extract_flow.hako"
|
||||
"lang.compiler.pipeline_v2.emit_return_box" = "lang/src/compiler/pipeline_v2/emit_return_box.hako"
|
||||
"lang.compiler.pipeline_v2.emit_binop_box" = "lang/src/compiler/pipeline_v2/emit_binop_box.hako"
|
||||
"lang.compiler.pipeline_v2.emit_compare_box" = "lang/src/compiler/pipeline_v2/emit_compare_box.hako"
|
||||
"lang.compiler.pipeline_v2.regex_flow" = "lang/src/compiler/pipeline_v2/regex_flow.hako"
|
||||
"lang.compiler.pipeline_v2.emit_call_box" = "lang/src/compiler/pipeline_v2/emit_call_box.hako"
|
||||
"lang.compiler.pipeline_v2.emit_method_box" = "lang/src/compiler/pipeline_v2/emit_method_box.hako"
|
||||
"lang.compiler.pipeline_v2.emit_newbox_box" = "lang/src/compiler/pipeline_v2/emit_newbox_box.hako"
|
||||
"lang.compiler.pipeline_v2.mir_call_box" = "lang/src/compiler/pipeline_v2/mir_call_box.hako"
|
||||
"lang.compiler.pipeline_v2.compare_extract_box" = "lang/src/compiler/pipeline_v2/compare_extract_box.hako"
|
||||
"lang.compiler.pipeline_v2.normalizer_box" = "lang/src/compiler/pipeline_v2/normalizer_box.hako"
|
||||
"lang.compiler.pipeline_v2.map_helpers_box" = "lang/src/compiler/pipeline_v2/map_helpers_box.hako"
|
||||
"lang.compiler.pipeline_v2.call_extract_box" = "lang/src/compiler/pipeline_v2/call_extract_box.hako"
|
||||
"lang.compiler.pipeline_v2.method_extract_box" = "lang/src/compiler/pipeline_v2/method_extract_box.hako"
|
||||
"lang.compiler.pipeline_v2.new_extract_box" = "lang/src/compiler/pipeline_v2/new_extract_box.hako"
|
||||
"lang.compiler.pipeline_v2.using_resolver_box" = "lang/src/compiler/pipeline_v2/using_resolver_box.hako"
|
||||
"lang.compiler.pipeline_v2.namespace_box" = "lang/src/compiler/pipeline_v2/namespace_box.hako"
|
||||
"lang.compiler.pipeline_v2.signature_verifier_box" = "lang/src/compiler/pipeline_v2/signature_verifier_box.hako"
|
||||
"lang.compiler.pipeline_v2.stage1_json_scanner_box" = "lang/src/compiler/pipeline_v2/stage1_json_scanner_box.hako"
|
||||
"lang.compiler.pipeline_v2.stage1_name_args_normalizer_box" = "lang/src/compiler/pipeline_v2/stage1_name_args_normalizer_box.hako"
|
||||
"lang.compiler.pipeline_v2.alias_preflight_box" = "lang/src/compiler/pipeline_v2/alias_preflight_box.hako"
|
||||
"lang.compiler.pipeline_v2.stage1_args_parser_box" = "lang/src/compiler/pipeline_v2/stage1_args_parser_box.hako"
|
||||
"lang.compiler.pipeline_v2.pipeline_helpers_box" = "lang/src/compiler/pipeline_v2/pipeline_helpers_box.hako"
|
||||
"lang.compiler.pipeline_v2.backend_box" = "lang/src/compiler/pipeline_v2/backend_box.hako"
|
||||
"lang.compiler.pipeline_v2.execution_pipeline_box" = "lang/src/compiler/pipeline_v2/execution_pipeline_box.hako"
|
||||
"lang.compiler.pipeline_v2.mir_builder_box" = "lang/src/compiler/pipeline_v2/mir_builder_box.hako"
|
||||
"lang.compiler.pipeline_v2.name_resolve_box" = "lang/src/compiler/pipeline_v2/name_resolve_box.hako"
|
||||
"lang.compiler.pipeline_v2.pipeline_emit_box" = "lang/src/compiler/pipeline_v2/pipeline_emit_box.hako"
|
||||
"lang.compiler.pipeline_v2.readonly_map_view" = "lang/src/compiler/pipeline_v2/readonly_map_view.hako"
|
||||
"lang.compiler.pipeline_v2.stage1_int_args_extract_box" = "lang/src/compiler/pipeline_v2/stage1_int_args_extract_box.hako"
|
||||
"lang.compiler.pipeline_v2.terminator_guard_box" = "lang/src/compiler/pipeline_v2/terminator_guard_box.hako"
|
||||
"lang.compiler.pipeline_v2.emit_mir_flow" = "lang/src/compiler/pipeline_v2/emit_mir_flow.hako"
|
||||
"lang.compiler.pipeline_v2.emit_mir_flow_map" = "lang/src/compiler/pipeline_v2/emit_mir_flow_map.hako"
|
||||
"selfhost.shared.json.mir_v1_meta_inject_box" = "lang/src/shared/json/mir_v1_meta_inject_box.hako"
|
||||
"selfhost.shared.json.json_inst_encode_box" = "lang/src/shared/json/json_inst_encode_box.hako"
|
||||
"selfhost.shared.common.string_ops" = "lang/src/shared/common/string_ops.hako"
|
||||
"lang.compiler.pipeline_v2.using_resolver" = "lang/src/compiler/pipeline_v2/using_resolver_box.hako"
|
||||
"lang.compiler.builder.ssa.local" = "lang/src/compiler/builder/ssa/local.hako"
|
||||
"lang.compiler.builder.ssa.localvar" = "lang/src/compiler/builder/ssa/local_ssa.hako"
|
||||
"lang.compiler.builder.ssa.loop" = "lang/src/compiler/builder/ssa/loopssa.hako"
|
||||
"lang.compiler.builder.ssa.cond_inserter" = "lang/src/compiler/builder/ssa/cond_inserter.hako"
|
||||
"lang.compiler.builder.rewrite.special" = "lang/src/compiler/builder/rewrite/special.hako"
|
||||
"lang.compiler.builder.rewrite.known" = "lang/src/compiler/builder/rewrite/known.hako"
|
||||
"lang.compiler.pipeline_v2.localvar_ssa_box" = "lang/src/compiler/pipeline_v2/local_ssa_box.hako"
|
||||
"lang.compiler.entry.compiler" = "lang/src/compiler/entry/compiler.hako"
|
||||
"lang.compiler.entry.compiler_stageb" = "lang/src/compiler/entry/compiler_stageb.hako"
|
||||
"lang.compiler.emit.mir_emitter_box" = "lang/src/compiler/emit/mir_emitter_box.hako"
|
||||
"lang.compiler.emit.common.json_emit_box" = "lang/src/compiler/emit/common/json_emit_box.hako"
|
||||
"lang.compiler.emit.common.mir_emit_box" = "lang/src/compiler/emit/common/mir_emit_box.hako"
|
||||
"lang.compiler.emit.common.call_emit_box" = "lang/src/compiler/emit/common/call_emit_box.hako"
|
||||
@ -95,13 +135,16 @@ path = "lang/src/shared/common/string_helpers.hako"
|
||||
"selfhost.shared.common.mini_vm_binop" = "lang/src/shared/common/mini_vm_binop.hako"
|
||||
"selfhost.shared.common.mini_vm_compare" = "lang/src/shared/common/mini_vm_compare.hako"
|
||||
"selfhost.shared.common.string_helpers" = "lang/src/shared/common/string_helpers.hako"
|
||||
"selfhost.shared.common.string_ops" = "lang/src/shared/common/string_ops.hako"
|
||||
"selfhost.shared.common.box_helpers" = "lang/src/shared/common/box_helpers.hako"
|
||||
"selfhost.shared.json.mir_builder_min" = "lang/src/shared/json/mir_builder_min.hako"
|
||||
"selfhost.shared.json.mir_v1_adapter" = "lang/src/shared/json/mir_v1_adapter.hako"
|
||||
"selfhost.shared.json.core.json_cursor" = "lang/src/shared/json/json_cursor.hako"
|
||||
"selfhost.shared.json.core.string_scan" = "lang/src/shared/json/core/string_scan.hako"
|
||||
"selfhost.shared.json.core.json_scan" = "lang/src/shared/json/core/json_scan.hako"
|
||||
"selfhost.shared.json.utils.json_utils" = "lang/src/shared/json/json_utils.hako"
|
||||
"selfhost.shared.json.stringify" = "lang/src/shared/json/stringify.hako"
|
||||
"selfhost.shared.mir.schema" = "lang/src/shared/mir/mir_schema_box.hako"
|
||||
"selfhost.shared.mir.loopform" = "lang/src/shared/mir/loop_form_box.hako"
|
||||
"selfhost.shared.mir.builder" = "lang/src/shared/mir/block_builder_box.hako"
|
||||
"selfhost.shared.mir.io" = "lang/src/shared/mir/mir_io_box.hako"
|
||||
"selfhost.shared.mir.json_emit" = "lang/src/shared/mir/json_emit_box.hako"
|
||||
|
||||
Reference in New Issue
Block a user