[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
10.1.1 C++ Bison Interface
The C++ parser LALR(1) skeleton is named ‘lalr1.cc’. To
select it, you may either pass the option ‘--skeleton=lalr1.cc’
to Bison, or include the directive ‘%skeleton "lalr1.cc"’ in the
grammar preamble. When run, bison
will create several
entities in the ‘yy’ namespace. Use the ‘%name-prefix’
directive to change the namespace name, see Bison Declaration Summary. The
various classes are generated in the following files:
- ‘position.hh’
- ‘location.hh’
The definition of the classes
position
andlocation
, used for location tracking. See section C++ Location Values.- ‘stack.hh’
An auxiliary class
stack
used by the parser.- ‘file.hh’
- ‘file.cc’
(Assuming the extension of the input file was ‘.yy’.) The declaration and implementation of the C++ parser class. The basename and extension of these two files follow the same rules as with regular C parsers (see section Invoking Bison).
The header is mandatory; you must either pass ‘-d’/‘--defines’ to
bison
, or use the ‘%defines’ directive.
All these files are documented using Doxygen; run doxygen
for a complete and accurate documentation.