selfhost: introduce using-based imports for compiler/parser/tools; keep includes temporarily. llvm: add PHI wiring JSON trace + unit/integration tests; fast test suite extended. runner: split selfhost helpers, small cleanups.

This commit is contained in:
Selfhosting Dev
2025-09-18 13:35:38 +09:00
parent 3fe908eb0d
commit 951a050592
49 changed files with 644 additions and 287 deletions

View File

@ -2,6 +2,13 @@
// Reads tmp/ny_parser_input.ny and prints a minimal JSON v0 program.
// Components are split under boxes/ and included here.
// Prefer using for module declaration (Runner strips and registers)
using "apps/selfhost-compiler/boxes/debug_box.nyash" as DebugBoxMod
using "apps/selfhost-compiler/boxes/parser_box.nyash" as ParserBoxMod
using "apps/selfhost-compiler/boxes/emitter_box.nyash" as EmitterBoxMod
using "apps/selfhost-compiler/boxes/mir_emitter_box.nyash" as MirEmitterBoxMod
// Transitional: keep include for Phase-15 compatibility
include "apps/selfhost-compiler/boxes/debug_box.nyash"
include "apps/selfhost-compiler/boxes/parser_box.nyash"
include "apps/selfhost-compiler/boxes/emitter_box.nyash"
@ -35,7 +42,7 @@ static box Main {
// Parser delegation
parse_program(src, stage3_flag) {
local parser = new ParserBox()
local parser = new ParserBoxMod.ParserBox()
if stage3_flag == 1 { parser.stage3_enable(1) }
// Collect using metadata (no-op acceptance in Stage15)
parser.extract_usings(src)
@ -45,7 +52,7 @@ static box Main {
main(args) {
// Debug setup
me.dbg = new DebugBox()
me.dbg = new DebugBoxMod.DebugBox()
me.dbg.set_enabled(0)
// Source selection (EXE-first friendly)
@ -112,11 +119,11 @@ static box Main {
if emit_mir == 1 {
// Lower minimal AST to MIR JSON (Return(Int) only for MVP)
local mir = new MirEmitterBox()
local mir = new MirEmitterBoxMod.MirEmitterBox()
json = mir.emit_mir_min(ast_json)
} else {
// Emit Stage1 JSON with metadata
local emitter = new EmitterBox()
local emitter = new EmitterBoxMod.EmitterBox()
json = emitter.emit_program(ast_json, me._usings)
}

View File

@ -1,5 +1,6 @@
// Entry: read stdin, parse with ParserV0, print JSON IR or error JSON
using "./apps/selfhost/ny-parser-nyash/parser_minimal.nyash" as ParserMod
include "./apps/selfhost/ny-parser-nyash/parser_minimal.nyash"
static box Main {

View File

@ -1,5 +1,6 @@
// Minimal recursive-descent parser for Ny v0 producing JSON IR v0 (MapBox)
using "./apps/selfhost/ny-parser-nyash/tokenizer.nyash" as Tokenizer
include "./apps/selfhost/ny-parser-nyash/tokenizer.nyash"
static box ParserV0 {

View File

@ -1,5 +1,6 @@
// dep_tree_main.nyash — entry script to print JSON tree
using "./apps/selfhost/tools/dep_tree.nyash" as DepTree
include "./apps/selfhost/tools/dep_tree.nyash"
static box Main {