Suppress "never useful" precedence warning in modular parser specifications?

423 Views Asked by At

Is it possible to suppress unused precedence warnings in menhir?

Background:

I have a core parser Lib.mly with several rules and, separately, a host of additional parsers (A.mly, B.mly, ...) which use definitions from Lib.mly. To support using a single lexer for all the languages, all tokens are defined in Lib.mly and we use external_tokens(Lib) annotations in _tags and have extended myocamlbuild.ml to suppress unused tokens warnings with --unused-tokens which helps significantly. However, I still get many warnings of the form:

File "parsers/ParserLib.mly", line 126, characters 0-9:                     
Warning: the precedence level assigned to FIX is never useful.              

These make it hard to see other warnings I actually want to address. Different subsets of the operators are used in various languages, so I need to have a single "global" precedence that orders them appropriately. Thanks for any tips!

2

There are 2 best solutions below

1
On BEST ANSWER

As of today, Menhir has a new option --unused-precedence-levels.

If you have examples of grammars that are split over several files, I might be interested to look at them (and possibly include some of them in Menhir's test suite, if permitted).

1
On

Not sure if this is what you're searching for but the two following options may be useful :

--unused-token <token>           Do not warn that <token> is unused
--unused-tokens                  Do not warn about any unused token