Next: Multiple Parsers, Previous: Named References, Up: Grammar File [Contents][Index]
The Bison declarations section of a Bison grammar defines the symbols used in formulating the grammar and the data types of semantic values. See Symbols.
All token type names (but not single-character literal tokens such as
'+'
and '*'
) must be declared. Nonterminal symbols must be
declared if you need to specify which data type to use for the semantic
value (see More Than One Value Type).
The first rule in the grammar file also specifies the start symbol, by default. If you want some other symbol to be the start symbol, you must declare it explicitly (see Languages and Context-Free Grammars).
• Require Decl: | Requiring a Bison version. | |
• Token Decl: | Declaring terminal symbols. | |
• Precedence Decl: | Declaring terminals with precedence and associativity. | |
• Type Decl: | Declaring the choice of type for a nonterminal symbol. | |
• Initial Action Decl: | Code run before parsing starts. | |
• Destructor Decl: | Declaring how symbols are freed. | |
• Printer Decl: | Declaring how symbol values are displayed. | |
• Expect Decl: | Suppressing warnings about parsing conflicts. | |
• Start Decl: | Specifying the start symbol. | |
• Pure Decl: | Requesting a reentrant parser. | |
• Push Decl: | Requesting a push parser. | |
• Decl Summary: | Table of all Bison declarations. | |
• %define Summary: | Defining variables to adjust Bison’s behavior. | |
• %code Summary: | Inserting code into the parser source. |
Next: Multiple Parsers, Previous: Named References, Up: Grammar File [Contents][Index]