From d3103cead8a9e8d72abf72e8637d8f61da5c14c5 Mon Sep 17 00:00:00 2001 From: Selfhosting Dev Date: Wed, 17 Sep 2025 01:24:22 +0900 Subject: [PATCH] cli: add --stage3 flag to enable Stage-3 acceptance for selfhost parser (sets NYASH_NY_COMPILER_STAGE3=1) --- src/cli.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cli.rs b/src/cli.rs index 4297554b..b4ff247b 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -105,6 +105,12 @@ impl CliConfig { .value_name("FILE") .help("Read Ny JSON IR v0 from a file and execute via MIR Interpreter") ) + .arg( + Arg::new("stage3") + .long("stage3") + .help("Enable Stage-3 syntax acceptance for selfhost parser (sets NYASH_NY_COMPILER_STAGE3=1)") + .action(clap::ArgAction::SetTrue) + ) .arg( Arg::new("ny-compiler-args") .long("ny-compiler-args") @@ -381,6 +387,10 @@ impl CliConfig { /// Convert ArgMatches to CliConfig fn from_matches(matches: &ArgMatches) -> Self { + // Stage-3 gate: when specified via CLI, set env for selfhost child + if matches.get_flag("stage3") { + std::env::set_var("NYASH_NY_COMPILER_STAGE3", "1"); + } // Side-effect: forward child args for selfhost compiler via env if let Some(a) = matches.get_one::("ny-compiler-args") { std::env::set_var("NYASH_NY_COMPILER_CHILD_ARGS", a);