[wish] first class token precedence
It would be nice if Menhir could generate an OCaml value representing the precedence of tokens. I'd like to then generate (automatically) that part of the the documentation of my language.
Since tokens can carry a value, I'd be happy to say %example TOKEN "foo"
to ease the creation of that value.
Alternatively, Menhir could take that piece of info out of an OCaml value crafted by the user, eg
%precedence <
[ Nonassoc [ TOK1 ]
| Right [ TOK2 "foo" ; TOK3 ]
| ..
]
>
in place of
%nonassoc TOK1
%right TOK2 TOK3
One could define that concrete list in another file if he wishes to access it later.