feat(lang): L9 resource files - registry ... from

registry NAME of RECORD [as PREFIX] from "file.lres" fills a registry from a data
file of key { field: value } entries, read at compile time with the record as its
schema: every entry is checked like a def, errors name the resource file's line,
nested records and lists of them are bare { } / [{ }] typed by their fields, and
values are expressions in the registry's module. The entries are compiled in, so
nothing parses at start-up and a build that succeeds has validated its resources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-24 14:00:20 +03:00
parent 7e7f3ab297
commit e543525eb7
15 changed files with 46229 additions and 44690 deletions

View file

@ -58,12 +58,19 @@ function parse_registry() -> void {
pi += 1
prefix = eat_id()
}
var from: pointer = null
if is_id("from") {
pi += 1
from = toks[pi].text
pi += 1
}
v.ty = "[]" + t
push(prog, v)
push(g_rg_name, v.s)
push(g_rg_type, t)
push(g_rg_prefix, prefix)
push(g_rg_var, v)
if from != null { res_read(v, from) }
}
# def REGISTRY key { field: value, ... }
function parse_def() -> void {