compiler: route --stage-b through main entry; document Stage-B status

This commit is contained in:
nyash-codex
2025-11-01 08:59:43 +09:00
parent e5331c87b0
commit bec43ea206
2 changed files with 9 additions and 2 deletions

View File

@ -2,6 +2,8 @@
// - When invoked with --min-json, emit minimal Program JSON v0 to stdout
// - Otherwise, act as a silent placeholder (return 0)
using "lang/src/compiler/entry/compiler_stageb.hako" as StageBMain
static box Main {
_parse_signed_int(raw) {
if raw == null { return null }
@ -28,7 +30,7 @@ static box Main {
_collect_flags(args) {
// Stage-A flags: emit/source/return only
local flags = { emit: 0, ret: null, source: null }
local flags = { emit: 0, ret: null, source: null, stage_b: 0 }
if args == null { return flags }
local i = 0
@ -37,6 +39,8 @@ static box Main {
local token = "" + args.get(i)
if token == "--min-json" {
flags.emit = 1
} else if token == "--stage-b" {
flags.stage_b = 1
} else if token == "--source" && i + 1 < n {
flags.source = "" + args.get(i + 1)
i = i + 1
@ -464,6 +468,9 @@ static box Main {
main(args) {
local flags = me._collect_flags(args)
if flags.stage_b == 1 {
return StageBMain.main(args)
}
if flags.emit == 1 {
local json = me._compile_source_to_json_v0(flags.source)
print(json)