- Update phase indicator to Phase 15 (Self-Hosting) - Update documentation links to Phase 15 resources - Reflect completion of R1-R5 tasks and ongoing work - Fix CURRENT_TASK.md location to root directory Co-Authored-By: Claude <noreply@anthropic.com>
30 lines
752 B
Plaintext
30 lines
752 B
Plaintext
// Entry: read stdin, parse with ParserV0, print JSON IR or error JSON
|
|
|
|
include("./apps/ny-parser-nyash/parser_minimal.nyash")
|
|
|
|
static box Main {
|
|
main(args) {
|
|
local console = new ConsoleBox()
|
|
// Read all stdin
|
|
local buf = ""
|
|
loop(true) {
|
|
local line = console.readLine()
|
|
if line == null { break }
|
|
buf = buf + line + "\n"
|
|
}
|
|
if buf == "" { buf = "return 0\n" }
|
|
local ir = ParserV0.parse_program(buf)
|
|
// If already an Error envelope, print as-is
|
|
local s = ir.as_any().toString()
|
|
if s.indexOf("\"kind\":\"Error\"") >= 0 {
|
|
console.log(s)
|
|
return 1
|
|
}
|
|
// Expect MapBox with Program; toJson available on MapBox
|
|
local json = ir.toJson()
|
|
console.log(json)
|
|
return 0
|
|
}
|
|
}
|
|
|