ocamlmenhir

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


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!


Solution

  • 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).