feat(compiler): list literals, typed compound assignment, file:line diagnostics
- `[a, b, c]` list literals (E_LIST → emit_list); static_type learns slice-element, `new T`, list, string and literal kinds - `x op= y` lowers through the same path as `x = x op y` (emit_bin_vals): fixed `*=`/`/=` use the Q16.16 64-bit paths, string `+=` concatenates, int→long widens; unary `-` keeps a fixed operand's type (arith_ty) - one `unescape()` table for "strings", 'chars' and `interpolation`; `'\''`, `'\\'`, `'\"'` no longer read as 0; unterminated char literals and unexpected characters are errors instead of silently skipped - every diagnostic is `file:line: error: msg` (g_parse_file / g_err_file, Node.file + Node.line set by node()); tok_desc() in expectation errors; duplicate `function` names and unknown `phase` names are reported in source terms (phase_id used to default unknown phases to Overlay) - interpolation holes skip braces inside string literals - hand-IR preludes move from the user `@fn_` prefix to `@lp_` so a user `is_ws` / `str_eq` / `path_join` no longer collides at link time - `@ClearColor(expr)` accepts any constant expression; `Os.pid()` added (docs page + inventory); `str_starts()` in support/str - main.ludic: `else if` flag ladder, char literals, stale script comments - examples/lang/operators.ludic covers all of the above; os.ludic covers Os.pid; docs pages for Os.pid and the Overlay phase; ten changesets - reseeded: selfhost/ludicc.seed.ll is the new compiler's own fixpoint Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
ad548840c7
commit
647dfec334
88 changed files with 30081 additions and 29179 deletions
|
|
@ -7,7 +7,7 @@ const MAX_ENT: int = 1024
|
|||
|
||||
function has_systems() -> bool {
|
||||
var i = 0
|
||||
while i < len(prog) { if prog[i].kind == N_SYS { return true }; i = i + 1 }
|
||||
while i < len(prog) { if prog[i].kind == N_SYS { return true }; i += 1 }
|
||||
# a game with no hand-written handler but a well-known engine component still
|
||||
# runs a frame loop — the engine owns the system that ticks that component
|
||||
# (#43/#47). Treat it as a systems game so the loop / tick helpers are emitted.
|
||||
|
|
@ -16,7 +16,7 @@ function has_systems() -> bool {
|
|||
}
|
||||
function has_models() -> bool {
|
||||
var i = 0
|
||||
while i < len(prog) { if prog[i].kind == N_ARCH { return true }; i = i + 1 }
|
||||
while i < len(prog) { if prog[i].kind == N_ARCH { return true }; i += 1 }
|
||||
return false
|
||||
}
|
||||
# does the program declare a well-known engine component? Each one is auto-ticked
|
||||
|
|
@ -30,7 +30,7 @@ function uses_engine_systems() -> bool {
|
|||
# Motion / Light2D; packages append via @EngineSystem), or an Occluder (which
|
||||
# feeds the Light2D pass without an esys of its own).
|
||||
var i = 0
|
||||
while i < len(g_esys_comp) { if find_comp(g_esys_comp[i]) != null { return true }; i = i + 1 }
|
||||
while i < len(g_esys_comp) { if find_comp(g_esys_comp[i]) != null { return true }; i += 1 }
|
||||
if find_comp("Occluder") != null { return true }
|
||||
return false
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@ function uses_engine_systems() -> bool {
|
|||
# compiler's auto frame loop. A game with handlers and no entry uses the auto-loop.
|
||||
function has_entry() -> bool {
|
||||
var i = 0
|
||||
while i < len(prog) { if prog[i].kind == N_MAIN { return true }; i = i + 1 }
|
||||
while i < len(prog) { if prog[i].kind == N_MAIN { return true }; i += 1 }
|
||||
return false
|
||||
}
|
||||
# Does this program run the ECS? A property alone no longer answers that — the
|
||||
|
|
@ -82,11 +82,11 @@ function emit_ecs_storage() -> void {
|
|||
# one enabled-flag global per model and per handler (default enabled)
|
||||
if c.kind == N_ARCH { emith(`@ME_{c.s} = internal global i32 1\n`) }
|
||||
if c.kind == N_SYS { emith(`@HE_{c.s} = internal global i32 1\n`) }
|
||||
i = i + 1
|
||||
i += 1
|
||||
}
|
||||
# one enabled-flag global per toggled layer (default shown)
|
||||
var li = 0
|
||||
while li < len(g_toggled_layers) { emith(`@LE_{g_toggled_layers[li]} = internal global i32 1\n`); li = li + 1 }
|
||||
while li < len(g_toggled_layers) { emith(`@LE_{g_toggled_layers[li]} = internal global i32 1\n`); li += 1 }
|
||||
}
|
||||
|
||||
# L_reset(e): clear every has-flag and the archetype kind for entity e
|
||||
|
|
@ -100,7 +100,7 @@ function emit_ecs_allocator() -> void {
|
|||
emit(" "); emit(hn); emit(" = getelementptr inbounds ["); emit(me); emit(" x i8], ptr @H_"); emit(prog[i].s); emit(", i32 0, i32 %e\n")
|
||||
emit(" store i8 0, ptr "); emit(hn); emit("\n")
|
||||
}
|
||||
i = i + 1
|
||||
i += 1
|
||||
}
|
||||
emit(" %k = getelementptr inbounds ["); emit(me); emit(" x i32], ptr @L_kind, i32 0, i32 %e\n")
|
||||
emit(" store i32 0, ptr %k\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue