bnfc icon indicating copy to clipboard operation
bnfc copied to clipboard

List category of internal category should be internal

Open andreasabel opened this issue 2 years ago • 1 comments

BNFC creates an invalid parser if one makes a list of internal non-terminals.

EVar.              Exp ::= Ident            ;

internal VInteger. Val ::= Integer          ;
internal VExp.     Val ::= Exp "{" [Eq] "}" ;
internal VEq.      Eq  ::= Ident ":=" Val   ;

separator Eq ","                            ;

I didn't find any version of BNFC that would alert of the problem or silently do the right thing (make [Eq] internal as well).

Update: coercions of purely internal categories also end up in the parser, but do not cause errors there (just garbage).

andreasabel avatar Oct 26 '23 11:10 andreasabel

Maybe we should support internal { ... } blocks which can also contain list pragmas and rules etc.

andreasabel avatar Oct 27 '23 08:10 andreasabel