Closed dramforever closed 10 years ago
I'm new to bnfc, so tell me if I'm using it wrong
I'm beginning to understand it. BNFC is trying to start parsing Foo
by calling pFoo
. However, the Foo
here is [Expr]
, so it's invalid. I still think this is a bug, nevertheless.
Unless told otherwise (using the entrypoints
pragma) the test program will try to parse using the first category defined in your grammar (in your case, the first category is [Expr]).
Using a list category as an entry point is not supported in the current version. But I don't really see an immediate reason why that is, so it should probably be fixed.
A quick workaround is to create a dummy category to be the root of your abstract syntax tree. I.e. put this at the top of your grammar:
Foo. Bar ::= [Expr];
Thanks for that. :smiley_cat:
Varsågod!
The following LBNF generates bad haskell code with a few weird
p[Expr]
s.main
in generated TestFoo.hsAs you can see, the
p[Expr]
is breaking the program.