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
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
function find_arch_id(name: pointer) -> int {
|
||||
var i = 0; var n = 1
|
||||
while i < len(prog) { if prog[i].kind == N_ARCH { if (prog[i].s == name) { return n }; n = n + 1 }; i = i + 1 }
|
||||
while i < len(prog) { if prog[i].kind == N_ARCH { if (prog[i].s == name) { return n }; n += 1 }; i += 1 }
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ function emit_query(st: Node) -> void {
|
|||
let ip = emit_alloca("i32")
|
||||
store_at("i32", "0", ip)
|
||||
if nself < len(self_stk) { self_stk[nself] = ip } else { push(self_stk, ip) }
|
||||
nself = nself + 1
|
||||
nself += 1
|
||||
|
||||
let cond = lbl("qcond"); let body = lbl("qbody"); let nxt = lbl("qnext"); let endl = lbl("qend")
|
||||
emit(" br label %"); emit(cond); emit("\n")
|
||||
|
|
@ -54,7 +54,7 @@ function emit_query(st: Node) -> void {
|
|||
let keep = lbl("qt")
|
||||
emit(" br i1 "); emit(ok); emit(", label %"); emit(keep); emit(", label %"); emit(nxt); emit("\n")
|
||||
emit(keep); emit(":\n")
|
||||
t = t + 1
|
||||
t += 1
|
||||
}
|
||||
|
||||
# bind the requested components to the loop variables, in order
|
||||
|
|
@ -70,10 +70,10 @@ function emit_query(st: Node) -> void {
|
|||
let vslot = emit_alloca("ptr")
|
||||
emit(" store ptr "); emit(slot); emit(", ptr "); emit(vslot); emit("\n")
|
||||
loc_push(st.kids[vi].s, vslot, tm.s)
|
||||
vi = vi + 1
|
||||
vi += 1
|
||||
}
|
||||
}
|
||||
t = t + 1
|
||||
t += 1
|
||||
}
|
||||
|
||||
# optional where-clause
|
||||
|
|
@ -97,5 +97,5 @@ function emit_query(st: Node) -> void {
|
|||
store_at("i32", i3, ip)
|
||||
emit(" br label %"); emit(cond); emit("\n")
|
||||
emit(endl); emit(":\n"); g_term = false
|
||||
nself = nself - 1
|
||||
nself -= 1
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue