phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0
This commit is contained in:
@ -4,7 +4,7 @@ use std::{fs, process};
|
||||
|
||||
/// Execute using PyVM only (no Rust VM runtime). Emits MIR(JSON) and invokes tools/pyvm_runner.py.
|
||||
pub fn execute_pyvm_only(runner: &NyashRunner, filename: &str) {
|
||||
if std::env::var("NYASH_PYVM_TRACE").ok().as_deref() == Some("1") { eprintln!("[pyvm] entry"); }
|
||||
if crate::config::env::env_bool("NYASH_PYVM_TRACE") { eprintln!("[pyvm] entry"); }
|
||||
// Read the file
|
||||
let code = match fs::read_to_string(filename) {
|
||||
Ok(content) => content,
|
||||
@ -76,7 +76,7 @@ pub fn execute_pyvm_only(runner: &NyashRunner, filename: &str) {
|
||||
code = normalize_logical_ops(&code);
|
||||
|
||||
// Parse to AST
|
||||
if std::env::var("NYASH_PYVM_DUMP_CODE").ok().as_deref() == Some("1") {
|
||||
if crate::config::env::env_bool("NYASH_PYVM_DUMP_CODE") {
|
||||
eprintln!("[pyvm-code]\n{}", code);
|
||||
}
|
||||
let ast = match NyashParser::parse_from_string(&code) {
|
||||
@ -100,13 +100,13 @@ pub fn execute_pyvm_only(runner: &NyashRunner, filename: &str) {
|
||||
};
|
||||
|
||||
// Optional: VM-only escape analysis elision pass retained for parity with VM path
|
||||
if std::env::var("NYASH_VM_ESCAPE_ANALYSIS").ok().as_deref() == Some("1") {
|
||||
if crate::config::env::env_bool("NYASH_VM_ESCAPE_ANALYSIS") {
|
||||
let removed = nyash_rust::mir::passes::escape::escape_elide_barriers_vm(&mut compile_result.module);
|
||||
if removed > 0 { crate::cli_v!("[PyVM] escape_elide_barriers: removed {} barriers", removed); }
|
||||
}
|
||||
|
||||
// Optional: delegate to Ny selfhost executor (Stage 0 scaffold: no-op)
|
||||
if std::env::var("NYASH_SELFHOST_EXEC").ok().as_deref() == Some("1") {
|
||||
if crate::config::env::env_bool("NYASH_SELFHOST_EXEC") {
|
||||
// Emit MIR JSON to a temp file and invoke Ny runner script.
|
||||
let tmp_dir = std::path::Path::new("tmp");
|
||||
let _ = std::fs::create_dir_all(tmp_dir);
|
||||
@ -117,7 +117,7 @@ pub fn execute_pyvm_only(runner: &NyashRunner, filename: &str) {
|
||||
}
|
||||
// Resolve nyash executable and runner path
|
||||
let exe = std::env::current_exe().unwrap_or_else(|_| std::path::PathBuf::from("target/release/nyash"));
|
||||
let runner = std::path::Path::new("apps/selfhost-runtime/runner.nyash");
|
||||
let runner = std::path::Path::new("apps/selfhost-runtime/runner.hako");
|
||||
if !runner.exists() {
|
||||
eprintln!("❌ Selfhost runner missing: {}", runner.display());
|
||||
process::exit(1);
|
||||
|
||||
Reference in New Issue
Block a user