bnfc
bnfc copied to clipboard
Warn if numbered category variants exist outside of `coercions` range
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.
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