Next: Destructor Decl, Previous: Type Decl, Up: Declarations
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
yyparseis 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);
};