Sometimes your parser needs to perform some initializations before
parsing. The %initial-action
directive allows for such arbitrary
code.
Declare that the braced code must be invoked before parsing each time
yyparse
is called. The code may use$$
and@$
— initial value and location of the lookahead — and the%parse-param
.
For instance, if your locations use a file name, you may use
%parse-param { char const *file_name }; %initial-action { @$.initialize (file_name); };