In menhir the meaning of UMINUS

I checked the menhir examples in this link:; in this example, I copy some code snippet to below;

%token<int> INT  "42"
%token PLUS       "+"
%token MINUS      "-"
%token TIMES      "*"
%token DIV        "/"
%token LPAREN     "("
%token RPAREN     ")"
%token EOL

(* Token aliases can be used throughout the rest of the grammar. E.g.,
   they can be used in precedence declarations: *)

%left "+" "-"       /* lowest precedence */
%left "*" "/"       /* medium precedence */
%nonassoc UMINUS    /* highest precedence */

there is no token to UMINUS, so why UMINUS exists in precedence? I checked the menhir reference guide and found nothing about this.

UMINUS is not a token, just a “dummy” that can be used with %prec. See section 4.1.4 of the Menhir manual for details:



1 Like

Thanks for explanation.