Phase 2: enforce statement separators (Rule B)
The parser now requires a newline or ';' between statements (block() in selfhost/parse.ludic); two statements may no longer sit adjacent with only spaces. Also fixed if-without-else swallowing its trailing separator. Migration: tools/ludic-tools/migrate_separators.c inserts ';' at statement boundaries corpus-wide (examples, runtime, 25 self-host fragments, ~1100 boundaries). Verified semantically identical — the migrated compiler compiles itself to IR byte-identical to the pre-migration seed, and every golden game renders identically. Reseeded to the strict compiler; C-free fixpoint holds; test.sh 14/14. Docs: Rule B documented in LANGUAGE.md; BOOTSTRAP.md R1 + stale fences updated; check-docs green across all docs. Fixed a multi-line string literal in emit_expr.ludic (byte-identical \n escape) that the C toolchain lexer mis-lexes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
985f9ad8f2
commit
eac8f8f335
35 changed files with 3861 additions and 3588 deletions
|
|
@ -13,8 +13,8 @@ fn emit_member_addr(e: Node) -> ptr {
|
|||
if fidx < 0 { perr(sconcat("no such field ", e.s)) }
|
||||
g_addr_ty = field_type(s, e.s)
|
||||
let r = nreg()
|
||||
emit(" ") emit(r) emit(" = getelementptr inbounds ") emit(layout_ty(base.ty))
|
||||
emit(", ptr ") emit(base.code) emit(", i32 0, i32 ") emit(itoa(fidx)) emit("\n")
|
||||
emit(" "); emit(r); emit(" = getelementptr inbounds "); emit(layout_ty(base.ty))
|
||||
emit(", ptr "); emit(base.code); emit(", i32 0, i32 "); emit(itoa(fidx)); emit("\n")
|
||||
return r
|
||||
}
|
||||
|
||||
|
|
@ -26,13 +26,13 @@ fn emit_index_addr(e: Node) -> ptr {
|
|||
g_addr_ty = el
|
||||
# load the data pointer from the slice header (field 0)
|
||||
let dp = nreg()
|
||||
emit(" ") emit(dp) emit(" = getelementptr inbounds %LSlice, ptr ")
|
||||
emit(base.code) emit(", i32 0, i32 0\n")
|
||||
emit(" "); emit(dp); emit(" = getelementptr inbounds %LSlice, ptr ")
|
||||
emit(base.code); emit(", i32 0, i32 0\n")
|
||||
let data = nreg()
|
||||
emit(" ") emit(data) emit(" = load ptr, ptr ") emit(dp) emit("\n")
|
||||
emit(" "); emit(data); emit(" = load ptr, ptr "); emit(dp); emit("\n")
|
||||
let ix = emit_expr(e.b)
|
||||
let r = nreg()
|
||||
emit(" ") emit(r) emit(" = getelementptr inbounds ") emit(llty(el))
|
||||
emit(", ptr ") emit(data) emit(", i32 ") emit(ix.code) emit("\n")
|
||||
emit(" "); emit(r); emit(" = getelementptr inbounds "); emit(llty(el))
|
||||
emit(", ptr "); emit(data); emit(", i32 "); emit(ix.code); emit("\n")
|
||||
return r
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue