restore(lang/compiler): bring back lang/src/compiler from e917d400; add Hako index canaries and docs; implement Rust-side index operator (Array/Map get/set) with Fail‑Fast diagnostics
- restore: lang/src/compiler/** (parser/emit/builder/pipeline_v2) from e917d400 - docs: docs/development/selfhosting/index-operator-hako.md - smokes(hako): tools/smokes/v2/profiles/quick/core/index_operator_hako.sh (opt-in) - smokes(vm): adjust index_operator_vm.sh for semicolon gate + stable error text - rust/parser: allow IndexExpr and assignment LHS=Index; postfix parse LBRACK chain - rust/builder: lower arr/map index to BoxCall get/set; annotate array/map literals; Fail‑Fast for unsupported types - CURRENT_TASK: mark Rust side done; add Hako tasks checklist Note: files disappeared likely due to branch FF to a lineage without lang/src/compiler; no explicit delete commit found. Added anchor checks and suggested CI guard in follow-up.
This commit is contained in:
49
lang/src/compiler/pipeline_v2/execution_pipeline_box.hako
Normal file
49
lang/src/compiler/pipeline_v2/execution_pipeline_box.hako
Normal file
@ -0,0 +1,49 @@
|
||||
// ExecutionPipelineBox — Orchestrate Parser → Emit (emit-only; no execution)
|
||||
using lang.compiler.parser.box as ParserBoxMod
|
||||
// Parser dependencies (Phase 2 refactoring: hierarchical structure)
|
||||
using lang.compiler.parser.scan.parser_string_utils_box
|
||||
using lang.compiler.parser.scan.parser_ident_scan_box
|
||||
using lang.compiler.parser.scan.parser_number_scan_box
|
||||
using lang.compiler.parser.scan.parser_string_scan_box
|
||||
using lang.compiler.parser.using.using_collector_box
|
||||
using lang.compiler.parser.expr.parser_expr_box
|
||||
using lang.compiler.parser.expr.parser_peek_box
|
||||
using lang.compiler.parser.expr.parser_literal_box
|
||||
using lang.compiler.parser.stmt.parser_stmt_box
|
||||
using lang.compiler.parser.stmt.parser_control_box
|
||||
using lang.compiler.parser.stmt.parser_exception_box
|
||||
using lang.compiler.stage1.json_program_box
|
||||
using lang.compiler.stage1.emitter_box as EmitterBoxMod
|
||||
using "lang/src/compiler/pipeline_v2/backend_box.hako" as BackendBoxMod
|
||||
|
||||
box ExecutionPipelineBox {
|
||||
backend_name
|
||||
backend
|
||||
|
||||
birth(name) {
|
||||
// Optional backend tag (no execution here)
|
||||
if name == null { name = "vm" }
|
||||
me.backend_name = name
|
||||
me.backend = new BackendBox(name)
|
||||
return 0
|
||||
}
|
||||
|
||||
// Run with source text; stage3_flag=1 enables Stage‑3 acceptance in parser
|
||||
run_source(src, stage3_flag) {
|
||||
if src == null { src = "return 0" }
|
||||
if stage3_flag == null { stage3_flag = 0 }
|
||||
// Parse
|
||||
local p = new ParserBox()
|
||||
if stage3_flag == 1 { p.stage3_enable(1) }
|
||||
p.extract_usings(src)
|
||||
local usings = p.get_usings_json()
|
||||
local ast = p.parse_program2(src)
|
||||
// Emit Stage‑1 JSON with meta.usings
|
||||
local json = EmitterBox.emit_program(ast, usings)
|
||||
if json == null || json.size() == 0 { return 1 }
|
||||
print(json)
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
static box ExecutionPipelineStub { main(args) { return 0 } }
|
||||
Reference in New Issue
Block a user