BNFC / bnfc

BNF Converter
http://bnfc.digitalgrammars.com/
586 stars 165 forks source link

Warn if numbered category variants exist outside of `coercions` range #334

Open andreasabel opened 3 years ago

andreasabel commented 3 years ago

The pragma e.g. coercions Exp 3 should issue a warning if the grammar contains variants of Exp outside of the range 1-3. This is more likely a mistake than intention. Often, there is confusion if the variant with the least precedence is Exp or Exp0. Also, a user might have added more higher precedences without updating the coercions pragma.

andreasabel commented 3 years ago

There seems to be a use case for variants without coercions, see: https://github.com/BNFC/bnfc/blob/3a5980285494270531df9defa65524f23482217f/examples/define/test.cf#L32-L40 https://github.com/BNFC/bnfc/blob/3a5980285494270531df9defa65524f23482217f/examples/define/test.cf#L46-L46