Disallow "never useful" priority warning in parser modular specifications?

Is it possible to suppress warnings about unused priorities in menhir?

Background:

I have a core syntactic analyzer Lib.mlywith multiple rules and, separately, a number of additional parsers ( A.mly, B.mly, ...), that use of the definition Lib.mly. To support the use of a single lexer for all languages, all tokens are defined in Lib.mly, and we use annotations external_tokens(Lib)in _tagsand extend myocamlbuild.mlto suppress unused token warnings with --unused-tokens, which helps a lot. However, I still get a lot of form warnings:

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

This makes it difficult to view other warnings that I really want to resolve. Different subsets of operators are used in different languages, so I need to have one "global" priority, which organizes them accordingly. Thanks for any tips!

+4
source share
2 answers

Menhir has a new option today --unused-precedence-levels.

If you have examples of grammars divided into several files, I might be interested to see them (and maybe include some of them in the Menhir test suite, if allowed).

+6
source

Not sure if this is what you are looking for, but the following two options may be useful:

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

Source: https://habr.com/ru/post/1690912/


All Articles