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
14
LANGUAGE.md
14
LANGUAGE.md
|
|
@ -130,7 +130,7 @@ system Nav phase Update {
|
|||
if ui_clicked(UI_Quit) { quit() }
|
||||
ui_set_int(UI_HpLabel, hp) # poke dynamic values by id
|
||||
}
|
||||
system Draw phase Render { clear(0x0e0e16) ui_render() present() }
|
||||
system Draw phase Render { clear(0x0e0e16); ui_render(); present() }
|
||||
```
|
||||
|
||||
See `examples/menu.ludic` for a complete title screen.
|
||||
|
|
@ -335,6 +335,18 @@ another `.ludic` file (see `examples/lib/`).
|
|||
`for (…) in query […] { }` · `break` · `continue` · `return` · `spawn` ·
|
||||
`despawn` · `match` · `machine`.
|
||||
|
||||
**Statements are separated by a newline or `;`** (both lex to the same separator
|
||||
token). Two statements may not sit adjacent with only spaces between them — the
|
||||
compiler reports `expected newline or ';' between statements`. Write one
|
||||
statement per line, or, to pack several onto a line, separate them with `;`:
|
||||
|
||||
```ludic
|
||||
# doc-check: skip — a bare statement block, not a whole declaration
|
||||
let x = 1
|
||||
x = x + 1 # one per line, the usual form
|
||||
let y = 1; y = y + 1 # or `;`-separated on one line
|
||||
```
|
||||
|
||||
`break` and `continue` apply to the innermost enclosing loop, and work in all
|
||||
three loop forms — `while`, the numeric `for`, and the ECS query loop, where
|
||||
`continue` advances to the next matching entity. Using either outside a loop is
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue