I am using ocamlyacc
for a small parser which also performs some semantic actions on most parsing rules.
I have defined a set of tokens in the beginning:
%token T_plus
%token T_minus
%token <int> T_int_const
%left T_plus T_minus
A parser rule which performs a semantic action is the following:
exp: exp T_plus exp
{
checkType T_plus $1 $3
}
where checkType
is an external helper function. However, I'm getting this strange warning (which refers to a line in my Parser.mly
file)
warning: T_plus was selected from type Parser.token.
It is not visible in the current scope,
and will not be selected if the type becomes unknown.
I haven't found any relevant info in the ocamlyacc manual. Has anyone encountered a similar error? Why is the token not visible inside the scope of the semantic action?