2025-10-31 20:18:39 +09:00
|
|
|
|
// 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()
|
2025-10-31 20:45:46 +09:00
|
|
|
|
// Extract extern_c annotations (syntax: @extern_c("c_symbol","Func/Arity");)
|
|
|
|
|
|
p.extract_externs(src)
|
|
|
|
|
|
local externs = p.get_externs_json()
|
2025-10-31 20:18:39 +09:00
|
|
|
|
local ast = p.parse_program2(src)
|
|
|
|
|
|
// Emit Stage‑1 JSON with meta.usings
|
2025-10-31 20:45:46 +09:00
|
|
|
|
local json = EmitterBox.emit_program(ast, usings, externs)
|
2025-10-31 20:18:39 +09:00
|
|
|
|
if json == null || json.size() == 0 { return 1 }
|
|
|
|
|
|
print(json)
|
|
|
|
|
|
return 0
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static box ExecutionPipelineStub { main(args) { return 0 } }
|