You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pest grammar has a data_decl rule (line 62 of ephapax.pest); the core parser's parse_declaration routes Rule::data_decl through parse_type_decl (lib.rs:146) and the core Decl enum has no Data variant — data decls are folded into Decl::Type with the constructors encoded as a binary-sum chain. The surface AST already models data properly (SurfaceDecl::Data(DataDecl)); only the core AST is the kludge.
What to do
Add Decl::Data { name: Var, type_params: Vec<SmolStr>, constructors: Vec<ConstructorDef> } (or similar) to ephapax-syntax.
Update parse_declaration in the core parser to build the new variant instead of routing through parse_type_decl.
Update the desugar pass: SurfaceDecl::Data already lowers to data-registry entries (no core Decl emitted); after this change the desugar can optionally emit a real Decl::Data for downstream consumers that want the structured form.
Context
The pest grammar has a
data_declrule (line 62 ofephapax.pest); the core parser'sparse_declarationroutesRule::data_declthroughparse_type_decl(lib.rs:146) and the coreDeclenum has noDatavariant — data decls are folded intoDecl::Typewith the constructors encoded as a binary-sum chain. The surface AST already models data properly (SurfaceDecl::Data(DataDecl)); only the core AST is the kludge.What to do
Decl::Data { name: Var, type_params: Vec<SmolStr>, constructors: Vec<ConstructorDef> }(or similar) toephapax-syntax.parse_declarationin the core parser to build the new variant instead of routing throughparse_type_decl.SurfaceDecl::Dataalready lowers to data-registry entries (no core Decl emitted); after this change the desugar can optionally emit a realDecl::Datafor downstream consumers that want the structured form.matchonDeclto handle the new arm (same audit pattern used forDecl::Externin feat(parser,desugar): extern abi blocks (clean — replaces #47/#53) #54).Acceptance
Decl::Datavariant exists with constructor list intactdatadeclsReferences
src/ephapax-parser/src/lib.rsparse_declaration, line 137.src/ephapax-syntax/src/lib.rsDeclenum, line 552.