www.delorie.com/gnu/docs/bison/bison_106.html   search  
 
Buy the book!


Bison 1.875

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A. Bison Symbols

Variable: @$
In an action, the location of the left-hand side of the rule. See section Locations Overview.

Variable: @n
In an action, the location of the n-th symbol of the right-hand side of the rule. See section Locations Overview.

Variable: $$
In an action, the semantic value of the left-hand side of the rule. See section 3.5.3 Actions.

Variable: $n
In an action, the semantic value of the n-th symbol of the right-hand side of the rule. See section 3.5.3 Actions.

Symbol: $accept
The predefined nonterminal whose only rule is `$accept: start $end', where start is the start symbol. See section The Start-Symbol. It cannot be used in the grammar.

Symbol: $end
The predefined token marking the end of the token stream. It cannot be used in the grammar.

Symbol: $undefined
The predefined token onto which all undefined values returned by yylex are mapped. It cannot be used in the grammar, rather, use error.

Symbol: error
A token name reserved for error recovery. This token may be used in grammar rules so as to allow the Bison parser to recognize an error in the grammar without halting the process. In effect, a sentence containing an error may be recognized as valid. On a syntax error, the token error becomes the current look-ahead token. Actions corresponding to error are then executed, and the look-ahead token is reset to the token that originally caused the violation. See section 6. Error Recovery.

Macro: YYABORT
Macro to pretend that an unrecoverable syntax error has occurred, by making yyparse return 1 immediately. The error reporting function yyerror is not called. See section The Parser Function yyparse.

Macro: YYACCEPT
Macro to pretend that a complete utterance of the language has been read, by making yyparse return 0 immediately. See section The Parser Function yyparse.

Macro: YYBACKUP
Macro to discard a value from the parser stack and fake a look-ahead token. See section Special Features for Use in Actions.

Macro: YYDEBUG
Macro to define to equip the parser with tracing code. See section Tracing Your Parser.

Macro: YYERROR
Macro to pretend that a syntax error has just been detected: call yyerror and then perform normal error recovery if possible (see section 6. Error Recovery), or (if recovery is impossible) make yyparse return 1. See section 6. Error Recovery.

Macro: YYERROR_VERBOSE
An obsolete macro that you define with #define in the prologue to request verbose, specific error message strings when yyerror is called. It doesn't matter what definition you use for YYERROR_VERBOSE, just whether you define it. Using %error-verbose is preferred.

Macro: YYINITDEPTH
Macro for specifying the initial size of the parser stack. See section 5.9 Stack Overflow, and How to Avoid It.

Macro: YYLEX_PARAM
An obsolete macro for specifying an extra argument (or list of extra arguments) for yyparse to pass to yylex. he use of this macro is deprecated, and is supported only for Yacc like parsers. See section Calling Conventions for Pure Parsers.

Type: YYLTYPE
Data type of yylloc; by default, a structure with four members. See section Data Types of Locations.

Macro: YYMAXDEPTH
Macro for specifying the maximum size of the parser stack. See section 5.9 Stack Overflow, and How to Avoid It.

Macro: YYPARSE_PARAM
An obsolete macro for specifying the name of a parameter that yyparse should accept. The use of this macro is deprecated, and is supported only for Yacc like parsers. See section Calling Conventions for Pure Parsers.

Macro: YYRECOVERING
Macro whose value indicates whether the parser is recovering from a syntax error. See section Special Features for Use in Actions.

Macro: YYSTACK_USE_ALLOCA
Macro used to control the use of alloca. If defined to `0', the parser will not use alloca but malloc when trying to grow its internal stacks. Do not define YYSTACK_USE_ALLOCA to anything else.

Type: YYSTYPE
Data type of semantic values; int by default. See section Data Types of Semantic Values.

Variable: yychar
External integer variable that contains the integer value of the current look-ahead token. (In a pure parser, it is a local variable within yyparse.) Error-recovery rule actions may examine this variable. See section Special Features for Use in Actions.

Variable: yyclearin
Macro used in error-recovery rule actions. It clears the previous look-ahead token. See section 6. Error Recovery.

Variable: yydebug
External integer variable set to zero by default. If yydebug is given a nonzero value, the parser will output information on input symbols and parser action. See section Tracing Your Parser.

Macro: yyerrok
Macro to cause parser to recover immediately to its normal mode after a syntax error. See section 6. Error Recovery.

Function: yyerror
User-supplied function to be called by yyparse on error. See section The Error Reporting Function yyerror.

Function: yylex
User-supplied lexical analyzer function, called with no arguments to get the next token. See section The Lexical Analyzer Function yylex.

Variable: yylval
External variable in which yylex should place the semantic value associated with a token. (In a pure parser, it is a local variable within yyparse, and its address is passed to yylex.) See section Semantic Values of Tokens.

Variable: yylloc
External variable in which yylex should place the line and column numbers associated with a token. (In a pure parser, it is a local variable within yyparse, and its address is passed to yylex.) You can ignore this variable if you don't use the `@' feature in the grammar actions. See section Textual Positions of Tokens.

Variable: yynerrs
Global variable which Bison increments each time there is a syntax error. (In a pure parser, it is a local variable within yyparse.) See section The Error Reporting Function yyerror.

Function: yyparse
The parser function produced by Bison; call this function to start parsing. See section The Parser Function yyparse.

Directive: %debug
Equip the parser for debugging. See section 3.7.9 Bison Declaration Summary.

Directive: %defines
Bison declaration to create a header file meant for the scanner. See section 3.7.9 Bison Declaration Summary.

Directive: %destructor
Specifying how the parser should reclaim the memory associated to discarded symbols. See section Freeing Discarded Symbols.

Directive: %dprec
Bison declaration to assign a precedence to a rule that is used at parse time to resolve reduce/reduce conflicts. See section Writing GLR Parsers.

Directive: %error-verbose
Bison declaration to request verbose, specific error message strings when yyerror is called.

Directive: %file-prefix="prefix"
Bison declaration to set the prefix of the output files. See section 3.7.9 Bison Declaration Summary.

Directive: %glr-parser
Bison declaration to produce a GLR parser. See section Writing GLR Parsers.

Directive: %left
Bison declaration to assign left associativity to token(s). See section Operator Precedence.

Directive: %merge
Bison declaration to assign a merging function to a rule. If there is a reduce/reduce conflict with a rule having the same merging function, the function is applied to the two semantic values to get a single result. See section Writing GLR Parsers.

Directive: %name-prefix="prefix"
Bison declaration to rename the external symbols. See section 3.7.9 Bison Declaration Summary.

Directive: %no-lines
Bison declaration to avoid generating #line directives in the parser file. See section 3.7.9 Bison Declaration Summary.

Directive: %nonassoc
Bison declaration to assign non-associativity to token(s). See section Operator Precedence.

Directive: %output="filename"
Bison declaration to set the name of the parser file. See section 3.7.9 Bison Declaration Summary.

Directive: %prec
Bison declaration to assign a precedence to a specific rule. See section Context-Dependent Precedence.

Directive: %pure-parser
Bison declaration to request a pure (reentrant) parser. See section A Pure (Reentrant) Parser.

Directive: %right
Bison declaration to assign right associativity to token(s). See section Operator Precedence.

Directive: %start
Bison declaration to specify the start symbol. See section The Start-Symbol.

Directive: %token
Bison declaration to declare token(s) without specifying precedence. See section Token Type Names.

Directive: %token-table
Bison declaration to include a token name table in the parser file. See section 3.7.9 Bison Declaration Summary.

Directive: %type
Bison declaration to declare nonterminals. See section Nonterminal Symbols.

Directive: %union
Bison declaration to specify several possible data types for semantic values. See section The Collection of Value Types.

These are the punctuation and delimiters used in Bison input:

Delimiter: %%
Delimiter used to separate the grammar rule section from the Bison declarations section or the epilogue. See section The Overall Layout of a Bison Grammar.

Delimiter: %{code%}
All code listed between `%{' and `%}' is copied directly to the output file uninterpreted. Such code forms the prologue of the input file. See section Outline of a Bison Grammar.

Construct: /*...*/
Comment delimiters, as in C.

Delimiter: :
Separates a rule's result from its components. See section Syntax of Grammar Rules.

Delimiter: ;
Terminates a rule. See section Syntax of Grammar Rules.

Delimiter: |
Separates alternate rules for the same result nonterminal. See section Syntax of Grammar Rules.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003