The handler-signature `query (vars) [terms] where …` clause and the
`reads`/`writes` clauses overlapped the `@Queries` annotation (and each other):
two ways to attach a query to a handler. Consolidated on the decorator.
- parse_system no longer parses `query`/`reads`/`writes` clauses; it keeps the
postfix `@anno(...)` channel and `phase`. A handler's query is the prefix
`@Queries(these: [...], on: Model)` annotation. Data-access hints are now
`@Reads(...)`/`@Writes(...)` — absorbed by the generic annotation skipper,
same parse-and-reserve status the old clauses had.
- The inline `for (…) in query […] where …` statement is unchanged and still
covers cross-property constraints / multiple kind filters. `query` stays a
keyword there (now dispatched via is_id so the vocabulary check sees it).
examples/hello.ludic and examples/qdecl.ludic migrated to `@Queries` (qdecl now
demonstrates a per-property constraint + `on:` tag); outputs unchanged
(4 4 10 3 / 0 3 -2). LANGUAGE.md handler sections rewritten. Vocabulary: drop
`reads`/`writes` from CLAUSE (ludic_syntax.h, grammar, LudicTokens.kt).
Reseeded (21931 lines); C-free fixpoint holds; goldens identical; 17/17;
vocab + doc-fences clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
33 lines
768 B
Text
33 lines
768 B
Text
# hello.ludic — smallest program that exercises the ECS pipeline
|
|
program Hello {
|
|
|
|
property Pos { x: int = 0, y: int = 0 }
|
|
property Vel { dx: int = 0, dy: int = 0 }
|
|
|
|
handler Boot phase Start {
|
|
spawn Mob {
|
|
Pos { x: 3, y: 4 }
|
|
Vel { dx: 1, dy: 0 }
|
|
}
|
|
spawn Mob {
|
|
Pos { x: 10, y: 2 }
|
|
Vel { dx: 0, dy: 1 }
|
|
}
|
|
}
|
|
|
|
# a handler declares the entities it operates on with @Queries: the body then
|
|
# runs once per match, each property bound by name and self() giving that entity.
|
|
@Queries(these: [Pos, Vel])
|
|
handler Move phase FixedUpdate {
|
|
Pos.x = Pos.x + Vel.dx
|
|
Pos.y = Pos.y + Vel.dy
|
|
}
|
|
|
|
handler Report phase Update {
|
|
for (p) in query [Pos] {
|
|
print_int(p.x)
|
|
print_int(p.y)
|
|
}
|
|
quit()
|
|
}
|
|
}
|