Conversation
…tinuation
Grammar sketch (NOT for merge) exploring how to attach an encoder
parenthetical `(base with encoder = …)` to a public actor member without
the shift/reduce conflict the naive `PUBLIC LPAR exp RPAR` form triggers
(state 354/433: `public (` is ambiguous between the encoder and a bare
parenthesized-expression field, since `dec` can begin with LPAR).
Idea (per Gabor): `vis` owns its continuation — `dec_field(ac|lo)`:
- `lo` (module/object): vis + general `dec` (unchanged);
- `ac` (actor/actor-class/mixin): public = `PUBLIC parenthetical? <func>`,
where the continuation is func-only (`dec_func`).
Because the `ac` public continuation starts with `shared`/`func` (never
`(`), there is no bare-LPAR dec to reduce into, so `public (` is
unambiguously the encoder. Reuses the existing `parenthetical` (which
requires `with`). menhir --strict reports no shift/reduce conflict, and
it enforces M0125 (public actor field = manifest function) at the grammar
level.
Wired only the `mixin` body to `obj_body_ac` as the demo `ac` site; a real
implementation would also route actor blocks + actor classes, and thread
the encoder value into the AST. Actions ignore the encoder value for now.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…flict-free
Refines the earlier func-only sketch. The actor/mixin public continuation
must admit `public func`, `public let = func`, and `public type` (all legal
public members; the first two marshal into the service, `public let=func`
being the desugaring of `public func`). A bare-expression public field
(`public 5`, `public (1,2)`) is dropped -> now a parse error instead of
M0125 (grammar-as-spec).
Tried the natural `dec` - `exp_nondec` factoring first, but `dec_nonvar`'s
`parenthetical_opt obj_or_class_dec` (the `(base with …) obj/class`
extension) is also LPAR-leading and re-introduced the shift/reduce. So the
continuation is the explicit `dec_pub = { let, type, func }`, none of which
begin with LPAR -> `public (` is unambiguously the encoder parenthetical.
menhir --strict: no shift/reduce conflict.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
public (…) parenthetical for encoder/decoder codecspublic (…) parenthetical for (e.g.) encoder/decoder codecs
`make -C src grammar` after adding `dec_pub`/`dec_field_ac`/`obj_body_ac` and rewiring the `mixin` body to `obj_body_ac`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…egion Routing the `mixin` body through `dec_field_ac` makes the inlined `system` visibility's `$sloc` span the whole member, so the M0130 region widens from `4.3-4.9` to `4.3-4.30` (same error). Regenerate both `.tc` and `.tc-human`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Note: widened M0130 region on
|
Experiment — not for merge. Explores placing the codec parenthetical after
publicrather than before it:The grammar insight
Making the visibility keyword own the continuation keeps the grammar conflict-free. A
publicmember is restricted to a manifestfunc/let/type(the newdec_pubnonterminal) — never a bare expression — so it cannot begin withLPAR. That makespublic (unambiguously the codec parenthetical, with no bare-LPARdeclaration to shift/reduce against:Two commits:
public (…) funcvia the vis-owned continuation (dec_pub= func only);dec_pubto{func, let, type}, still conflict-free.Currently wired into the
mixinbody (obj_body_ac). Rebased onto currentmaster;printers.mlgains symbol cases for the new nonterminals so the release build stays warning-clean.moc --checkaccepts both the explicit and punned forms.Prior art on the sibling branch
gabor/encoderplaces the same parenthetical beforepublic; this branch is the after-publicvariant.