mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 02:03:03 +00:00
Fix formatting and content of bison.texinfo menus
* doc/bison.texinfo: Synchronize ``Detail Node Listing''. Align menus. Adjust word wrapping. Use node names for menu names. (Examples): Don't abbreviate node names. (LocalWords): Remove abbreviations. (Copying): Make description a sentence. (Java Action Features): Remove period to match the rest of menu.
This commit is contained in:
@@ -1,3 +1,12 @@
|
|||||||
|
2008-11-17 Di-an Jan <dianj@freeshell.org>
|
||||||
|
|
||||||
|
* doc/bison.texinfo: Synchronize ``Detail Node Listing''.
|
||||||
|
Align menus. Adjust word wrapping. Use node names for menu names.
|
||||||
|
(Examples): Don't abbreviate node names.
|
||||||
|
(LocalWords): Remove abbreviations.
|
||||||
|
(Copying): Make description a sentence.
|
||||||
|
(Java Action Features): Remove period to match the rest of menu.
|
||||||
|
|
||||||
2008-11-11 Paolo Bonzini <bonzini@gnu.org>
|
2008-11-11 Paolo Bonzini <bonzini@gnu.org>
|
||||||
|
|
||||||
* bootstrap.conf: Replace m4/warning.m4 with warnings module.
|
* bootstrap.conf: Replace m4/warning.m4 with warnings module.
|
||||||
|
|||||||
@@ -89,76 +89,76 @@ Cover art by Etienne Suvasa.
|
|||||||
@menu
|
@menu
|
||||||
* Introduction::
|
* Introduction::
|
||||||
* Conditions::
|
* Conditions::
|
||||||
* Copying:: The @acronym{GNU} General Public License says
|
* Copying:: The @acronym{GNU} General Public License says
|
||||||
how you can copy and share Bison
|
how you can copy and share Bison.
|
||||||
|
|
||||||
Tutorial sections:
|
Tutorial sections:
|
||||||
* Concepts:: Basic concepts for understanding Bison.
|
* Concepts:: Basic concepts for understanding Bison.
|
||||||
* Examples:: Three simple explained examples of using Bison.
|
* Examples:: Three simple explained examples of using Bison.
|
||||||
|
|
||||||
Reference sections:
|
Reference sections:
|
||||||
* Grammar File:: Writing Bison declarations and rules.
|
* Grammar File:: Writing Bison declarations and rules.
|
||||||
* Interface:: C-language interface to the parser function @code{yyparse}.
|
* Interface:: C-language interface to the parser function @code{yyparse}.
|
||||||
* Algorithm:: How the Bison parser works at run-time.
|
* Algorithm:: How the Bison parser works at run-time.
|
||||||
* Error Recovery:: Writing rules for error recovery.
|
* Error Recovery:: Writing rules for error recovery.
|
||||||
* Context Dependency:: What to do if your language syntax is too
|
* Context Dependency:: What to do if your language syntax is too
|
||||||
messy for Bison to handle straightforwardly.
|
messy for Bison to handle straightforwardly.
|
||||||
* Debugging:: Understanding or debugging Bison parsers.
|
* Debugging:: Understanding or debugging Bison parsers.
|
||||||
* Invocation:: How to run Bison (to produce the parser source file).
|
* Invocation:: How to run Bison (to produce the parser source file).
|
||||||
* Other Languages:: Creating C++ and Java parsers.
|
* Other Languages:: Creating C++ and Java parsers.
|
||||||
* FAQ:: Frequently Asked Questions
|
* FAQ:: Frequently Asked Questions
|
||||||
* Table of Symbols:: All the keywords of the Bison language are explained.
|
* Table of Symbols:: All the keywords of the Bison language are explained.
|
||||||
* Glossary:: Basic concepts are explained.
|
* Glossary:: Basic concepts are explained.
|
||||||
* Copying This Manual:: License for copying this manual.
|
* Copying This Manual:: License for copying this manual.
|
||||||
* Index:: Cross-references to the text.
|
* Index:: Cross-references to the text.
|
||||||
|
|
||||||
@detailmenu
|
@detailmenu
|
||||||
--- The Detailed Node Listing ---
|
--- The Detailed Node Listing ---
|
||||||
|
|
||||||
The Concepts of Bison
|
The Concepts of Bison
|
||||||
|
|
||||||
* Language and Grammar:: Languages and context-free grammars,
|
* Language and Grammar:: Languages and context-free grammars,
|
||||||
as mathematical ideas.
|
as mathematical ideas.
|
||||||
* Grammar in Bison:: How we represent grammars for Bison's sake.
|
* Grammar in Bison:: How we represent grammars for Bison's sake.
|
||||||
* Semantic Values:: Each token or syntactic grouping can have
|
* Semantic Values:: Each token or syntactic grouping can have
|
||||||
a semantic value (the value of an integer,
|
a semantic value (the value of an integer,
|
||||||
the name of an identifier, etc.).
|
the name of an identifier, etc.).
|
||||||
* Semantic Actions:: Each rule can have an action containing C code.
|
* Semantic Actions:: Each rule can have an action containing C code.
|
||||||
* GLR Parsers:: Writing parsers for general context-free languages.
|
* GLR Parsers:: Writing parsers for general context-free languages.
|
||||||
* Locations Overview:: Tracking Locations.
|
* Locations Overview:: Tracking Locations.
|
||||||
* Bison Parser:: What are Bison's input and output,
|
* Bison Parser:: What are Bison's input and output,
|
||||||
how is the output used?
|
how is the output used?
|
||||||
* Stages:: Stages in writing and running Bison grammars.
|
* Stages:: Stages in writing and running Bison grammars.
|
||||||
* Grammar Layout:: Overall structure of a Bison grammar file.
|
* Grammar Layout:: Overall structure of a Bison grammar file.
|
||||||
|
|
||||||
Writing @acronym{GLR} Parsers
|
Writing @acronym{GLR} Parsers
|
||||||
|
|
||||||
* Simple GLR Parsers:: Using @acronym{GLR} parsers on unambiguous grammars.
|
* Simple GLR Parsers:: Using @acronym{GLR} parsers on unambiguous grammars.
|
||||||
* Merging GLR Parses:: Using @acronym{GLR} parsers to resolve ambiguities.
|
* Merging GLR Parses:: Using @acronym{GLR} parsers to resolve ambiguities.
|
||||||
* GLR Semantic Actions:: Deferred semantic actions have special concerns.
|
* GLR Semantic Actions:: Deferred semantic actions have special concerns.
|
||||||
* Compiler Requirements:: @acronym{GLR} parsers require a modern C compiler.
|
* Compiler Requirements:: @acronym{GLR} parsers require a modern C compiler.
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
|
|
||||||
* RPN Calc:: Reverse polish notation calculator;
|
* RPN Calc:: Reverse polish notation calculator;
|
||||||
a first example with no operator precedence.
|
a first example with no operator precedence.
|
||||||
* Infix Calc:: Infix (algebraic) notation calculator.
|
* Infix Calc:: Infix (algebraic) notation calculator.
|
||||||
Operator precedence is introduced.
|
Operator precedence is introduced.
|
||||||
* Simple Error Recovery:: Continuing after syntax errors.
|
* Simple Error Recovery:: Continuing after syntax errors.
|
||||||
* Location Tracking Calc:: Demonstrating the use of @@@var{n} and @@$.
|
* Location Tracking Calc:: Demonstrating the use of @@@var{n} and @@$.
|
||||||
* Multi-function Calc:: Calculator with memory and trig functions.
|
* Multi-function Calc:: Calculator with memory and trig functions.
|
||||||
It uses multiple data-types for semantic values.
|
It uses multiple data-types for semantic values.
|
||||||
* Exercises:: Ideas for improving the multi-function calculator.
|
* Exercises:: Ideas for improving the multi-function calculator.
|
||||||
|
|
||||||
Reverse Polish Notation Calculator
|
Reverse Polish Notation Calculator
|
||||||
|
|
||||||
* Decls: Rpcalc Decls. Prologue (declarations) for rpcalc.
|
* Rpcalc Declarations:: Prologue (declarations) for rpcalc.
|
||||||
* Rules: Rpcalc Rules. Grammar Rules for rpcalc, with explanation.
|
* Rpcalc Rules:: Grammar Rules for rpcalc, with explanation.
|
||||||
* Lexer: Rpcalc Lexer. The lexical analyzer.
|
* Rpcalc Lexer:: The lexical analyzer.
|
||||||
* Main: Rpcalc Main. The controlling function.
|
* Rpcalc Main:: The controlling function.
|
||||||
* Error: Rpcalc Error. The error reporting function.
|
* Rpcalc Error:: The error reporting function.
|
||||||
* Gen: Rpcalc Gen. Running Bison on the grammar file.
|
* Rpcalc Generate:: Running Bison on the grammar file.
|
||||||
* Comp: Rpcalc Compile. Run the C compiler on the output code.
|
* Rpcalc Compile:: Run the C compiler on the output code.
|
||||||
|
|
||||||
Grammar Rules for @code{rpcalc}
|
Grammar Rules for @code{rpcalc}
|
||||||
|
|
||||||
@@ -168,15 +168,15 @@ Grammar Rules for @code{rpcalc}
|
|||||||
|
|
||||||
Location Tracking Calculator: @code{ltcalc}
|
Location Tracking Calculator: @code{ltcalc}
|
||||||
|
|
||||||
* Decls: Ltcalc Decls. Bison and C declarations for ltcalc.
|
* Ltcalc Declarations:: Bison and C declarations for ltcalc.
|
||||||
* Rules: Ltcalc Rules. Grammar rules for ltcalc, with explanations.
|
* Ltcalc Rules:: Grammar rules for ltcalc, with explanations.
|
||||||
* Lexer: Ltcalc Lexer. The lexical analyzer.
|
* Ltcalc Lexer:: The lexical analyzer.
|
||||||
|
|
||||||
Multi-Function Calculator: @code{mfcalc}
|
Multi-Function Calculator: @code{mfcalc}
|
||||||
|
|
||||||
* Decl: Mfcalc Decl. Bison declarations for multi-function calculator.
|
* Mfcalc Declarations:: Bison declarations for multi-function calculator.
|
||||||
* Rules: Mfcalc Rules. Grammar rules for the calculator.
|
* Mfcalc Rules:: Grammar rules for the calculator.
|
||||||
* Symtab: Mfcalc Symtab. Symbol table management subroutines.
|
* Mfcalc Symbol Table:: Symbol table management subroutines.
|
||||||
|
|
||||||
Bison Grammar Files
|
Bison Grammar Files
|
||||||
|
|
||||||
@@ -191,11 +191,11 @@ Bison Grammar Files
|
|||||||
|
|
||||||
Outline of a Bison Grammar
|
Outline of a Bison Grammar
|
||||||
|
|
||||||
* Prologue:: Syntax and usage of the prologue.
|
* Prologue:: Syntax and usage of the prologue.
|
||||||
* Prologue Alternatives:: Syntax and usage of alternatives to the prologue.
|
* Prologue Alternatives:: Syntax and usage of alternatives to the prologue.
|
||||||
* Bison Declarations:: Syntax and usage of the Bison declarations section.
|
* Bison Declarations:: Syntax and usage of the Bison declarations section.
|
||||||
* Grammar Rules:: Syntax and usage of the grammar rules section.
|
* Grammar Rules:: Syntax and usage of the grammar rules section.
|
||||||
* Epilogue:: Syntax and usage of the epilogue.
|
* Epilogue:: Syntax and usage of the epilogue.
|
||||||
|
|
||||||
Defining Language Semantics
|
Defining Language Semantics
|
||||||
|
|
||||||
@@ -230,24 +230,28 @@ Bison Declarations
|
|||||||
|
|
||||||
Parser C-Language Interface
|
Parser C-Language Interface
|
||||||
|
|
||||||
* Parser Function:: How to call @code{yyparse} and what it returns.
|
* Parser Function:: How to call @code{yyparse} and what it returns.
|
||||||
* Lexical:: You must supply a function @code{yylex}
|
* Push Parser Function:: How to call @code{yypush_parse} and what it returns.
|
||||||
which reads tokens.
|
* Pull Parser Function:: How to call @code{yypull_parse} and what it returns.
|
||||||
* Error Reporting:: You must supply a function @code{yyerror}.
|
* Parser Create Function:: How to call @code{yypstate_new} and what it returns.
|
||||||
* Action Features:: Special features for use in actions.
|
* Parser Delete Function:: How to call @code{yypstate_delete} and what it returns.
|
||||||
* Internationalization:: How to let the parser speak in the user's
|
* Lexical:: You must supply a function @code{yylex}
|
||||||
native language.
|
which reads tokens.
|
||||||
|
* Error Reporting:: You must supply a function @code{yyerror}.
|
||||||
|
* Action Features:: Special features for use in actions.
|
||||||
|
* Internationalization:: How to let the parser speak in the user's
|
||||||
|
native language.
|
||||||
|
|
||||||
The Lexical Analyzer Function @code{yylex}
|
The Lexical Analyzer Function @code{yylex}
|
||||||
|
|
||||||
* Calling Convention:: How @code{yyparse} calls @code{yylex}.
|
* Calling Convention:: How @code{yyparse} calls @code{yylex}.
|
||||||
* Token Values:: How @code{yylex} must return the semantic value
|
* Token Values:: How @code{yylex} must return the semantic value
|
||||||
of the token it has read.
|
of the token it has read.
|
||||||
* Token Locations:: How @code{yylex} must return the text location
|
* Token Locations:: How @code{yylex} must return the text location
|
||||||
(line number, etc.) of the token, if the
|
(line number, etc.) of the token, if the
|
||||||
actions want that.
|
actions want that.
|
||||||
* Pure Calling:: How the calling convention differs
|
* Pure Calling:: How the calling convention differs in a pure parser
|
||||||
in a pure parser (@pxref{Pure Decl, ,A Pure (Reentrant) Parser}).
|
(@pxref{Pure Decl, ,A Pure (Reentrant) Parser}).
|
||||||
|
|
||||||
The Bison Parser Algorithm
|
The Bison Parser Algorithm
|
||||||
|
|
||||||
@@ -257,7 +261,7 @@ The Bison Parser Algorithm
|
|||||||
* Contextual Precedence:: When an operator's precedence depends on context.
|
* Contextual Precedence:: When an operator's precedence depends on context.
|
||||||
* Parser States:: The parser is a finite-state-machine with stack.
|
* Parser States:: The parser is a finite-state-machine with stack.
|
||||||
* Reduce/Reduce:: When two rules are applicable in the same situation.
|
* Reduce/Reduce:: When two rules are applicable in the same situation.
|
||||||
* Mystery Conflicts:: Reduce/reduce conflicts that look unjustified.
|
* Mystery Conflicts:: Reduce/reduce conflicts that look unjustified.
|
||||||
* Generalized LR Parsing:: Parsing arbitrary context-free grammars.
|
* Generalized LR Parsing:: Parsing arbitrary context-free grammars.
|
||||||
* Memory Management:: What happens when memory is exhausted. How to avoid it.
|
* Memory Management:: What happens when memory is exhausted. How to avoid it.
|
||||||
|
|
||||||
@@ -311,33 +315,33 @@ A Complete C++ Example
|
|||||||
|
|
||||||
Java Parsers
|
Java Parsers
|
||||||
|
|
||||||
* Java Bison Interface:: Asking for Java parser generation
|
* Java Bison Interface:: Asking for Java parser generation
|
||||||
* Java Semantic Values:: %type and %token vs. Java
|
* Java Semantic Values:: %type and %token vs. Java
|
||||||
* Java Location Values:: The position and location classes
|
* Java Location Values:: The position and location classes
|
||||||
* Java Parser Interface:: Instantiating and running the parser
|
* Java Parser Interface:: Instantiating and running the parser
|
||||||
* Java Scanner Interface:: Specifying the scanner for the parser
|
* Java Scanner Interface:: Specifying the scanner for the parser
|
||||||
* Java Action Features:: Special features for use in actions.
|
* Java Action Features:: Special features for use in actions
|
||||||
* Java Differences:: Differences between C/C++ and Java Grammars
|
* Java Differences:: Differences between C/C++ and Java Grammars
|
||||||
* Java Declarations Summary:: List of Bison declarations used with Java
|
* Java Declarations Summary:: List of Bison declarations used with Java
|
||||||
|
|
||||||
Frequently Asked Questions
|
Frequently Asked Questions
|
||||||
|
|
||||||
* Memory Exhausted:: Breaking the Stack Limits
|
* Memory Exhausted:: Breaking the Stack Limits
|
||||||
* How Can I Reset the Parser:: @code{yyparse} Keeps some State
|
* How Can I Reset the Parser:: @code{yyparse} Keeps some State
|
||||||
* Strings are Destroyed:: @code{yylval} Loses Track of Strings
|
* Strings are Destroyed:: @code{yylval} Loses Track of Strings
|
||||||
* Implementing Gotos/Loops:: Control Flow in the Calculator
|
* Implementing Gotos/Loops:: Control Flow in the Calculator
|
||||||
* Multiple start-symbols:: Factoring closely related grammars
|
* Multiple start-symbols:: Factoring closely related grammars
|
||||||
* Secure? Conform?:: Is Bison @acronym{POSIX} safe?
|
* Secure? Conform?:: Is Bison @acronym{POSIX} safe?
|
||||||
* I can't build Bison:: Troubleshooting
|
* I can't build Bison:: Troubleshooting
|
||||||
* Where can I find help?:: Troubleshouting
|
* Where can I find help?:: Troubleshouting
|
||||||
* Bug Reports:: Troublereporting
|
* Bug Reports:: Troublereporting
|
||||||
* Other Languages:: Parsers in Java and others
|
* More Languages:: Parsers in C++, Java, and so on
|
||||||
* Beta Testing:: Experimenting development versions
|
* Beta Testing:: Experimenting development versions
|
||||||
* Mailing Lists:: Meeting other Bison users
|
* Mailing Lists:: Meeting other Bison users
|
||||||
|
|
||||||
Copying This Manual
|
Copying This Manual
|
||||||
|
|
||||||
* Copying This Manual:: License for copying this manual.
|
* Copying This Manual:: License for copying this manual.
|
||||||
|
|
||||||
@end detailmenu
|
@end detailmenu
|
||||||
@end menu
|
@end menu
|
||||||
@@ -417,19 +421,19 @@ details of Bison will not make sense. If you do not already know how to
|
|||||||
use Bison or Yacc, we suggest you start by reading this chapter carefully.
|
use Bison or Yacc, we suggest you start by reading this chapter carefully.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Language and Grammar:: Languages and context-free grammars,
|
* Language and Grammar:: Languages and context-free grammars,
|
||||||
as mathematical ideas.
|
as mathematical ideas.
|
||||||
* Grammar in Bison:: How we represent grammars for Bison's sake.
|
* Grammar in Bison:: How we represent grammars for Bison's sake.
|
||||||
* Semantic Values:: Each token or syntactic grouping can have
|
* Semantic Values:: Each token or syntactic grouping can have
|
||||||
a semantic value (the value of an integer,
|
a semantic value (the value of an integer,
|
||||||
the name of an identifier, etc.).
|
the name of an identifier, etc.).
|
||||||
* Semantic Actions:: Each rule can have an action containing C code.
|
* Semantic Actions:: Each rule can have an action containing C code.
|
||||||
* GLR Parsers:: Writing parsers for general context-free languages.
|
* GLR Parsers:: Writing parsers for general context-free languages.
|
||||||
* Locations Overview:: Tracking Locations.
|
* Locations Overview:: Tracking Locations.
|
||||||
* Bison Parser:: What are Bison's input and output,
|
* Bison Parser:: What are Bison's input and output,
|
||||||
how is the output used?
|
how is the output used?
|
||||||
* Stages:: Stages in writing and running Bison grammars.
|
* Stages:: Stages in writing and running Bison grammars.
|
||||||
* Grammar Layout:: Overall structure of a Bison grammar file.
|
* Grammar Layout:: Overall structure of a Bison grammar file.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Language and Grammar
|
@node Language and Grammar
|
||||||
@@ -745,10 +749,10 @@ user-defined function on the resulting values to produce an arbitrary
|
|||||||
merged result.
|
merged result.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Simple GLR Parsers:: Using @acronym{GLR} parsers on unambiguous grammars.
|
* Simple GLR Parsers:: Using @acronym{GLR} parsers on unambiguous grammars.
|
||||||
* Merging GLR Parses:: Using @acronym{GLR} parsers to resolve ambiguities.
|
* Merging GLR Parses:: Using @acronym{GLR} parsers to resolve ambiguities.
|
||||||
* GLR Semantic Actions:: Deferred semantic actions have special concerns.
|
* GLR Semantic Actions:: Deferred semantic actions have special concerns.
|
||||||
* Compiler Requirements:: @acronym{GLR} parsers require a modern C compiler.
|
* Compiler Requirements:: @acronym{GLR} parsers require a modern C compiler.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Simple GLR Parsers
|
@node Simple GLR Parsers
|
||||||
@@ -1376,15 +1380,15 @@ languages are written the same way. You can copy these examples into a
|
|||||||
source file to try them.
|
source file to try them.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* RPN Calc:: Reverse polish notation calculator;
|
* RPN Calc:: Reverse polish notation calculator;
|
||||||
a first example with no operator precedence.
|
a first example with no operator precedence.
|
||||||
* Infix Calc:: Infix (algebraic) notation calculator.
|
* Infix Calc:: Infix (algebraic) notation calculator.
|
||||||
Operator precedence is introduced.
|
Operator precedence is introduced.
|
||||||
* Simple Error Recovery:: Continuing after syntax errors.
|
* Simple Error Recovery:: Continuing after syntax errors.
|
||||||
* Location Tracking Calc:: Demonstrating the use of @@@var{n} and @@$.
|
* Location Tracking Calc:: Demonstrating the use of @@@var{n} and @@$.
|
||||||
* Multi-function Calc:: Calculator with memory and trig functions.
|
* Multi-function Calc:: Calculator with memory and trig functions.
|
||||||
It uses multiple data-types for semantic values.
|
It uses multiple data-types for semantic values.
|
||||||
* Exercises:: Ideas for improving the multi-function calculator.
|
* Exercises:: Ideas for improving the multi-function calculator.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node RPN Calc
|
@node RPN Calc
|
||||||
@@ -1403,16 +1407,16 @@ The source code for this calculator is named @file{rpcalc.y}. The
|
|||||||
@samp{.y} extension is a convention used for Bison input files.
|
@samp{.y} extension is a convention used for Bison input files.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Decls: Rpcalc Decls. Prologue (declarations) for rpcalc.
|
* Rpcalc Declarations:: Prologue (declarations) for rpcalc.
|
||||||
* Rules: Rpcalc Rules. Grammar Rules for rpcalc, with explanation.
|
* Rpcalc Rules:: Grammar Rules for rpcalc, with explanation.
|
||||||
* Lexer: Rpcalc Lexer. The lexical analyzer.
|
* Rpcalc Lexer:: The lexical analyzer.
|
||||||
* Main: Rpcalc Main. The controlling function.
|
* Rpcalc Main:: The controlling function.
|
||||||
* Error: Rpcalc Error. The error reporting function.
|
* Rpcalc Error:: The error reporting function.
|
||||||
* Gen: Rpcalc Gen. Running Bison on the grammar file.
|
* Rpcalc Generate:: Running Bison on the grammar file.
|
||||||
* Comp: Rpcalc Compile. Run the C compiler on the output code.
|
* Rpcalc Compile:: Run the C compiler on the output code.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Rpcalc Decls
|
@node Rpcalc Declarations
|
||||||
@subsection Declarations for @code{rpcalc}
|
@subsection Declarations for @code{rpcalc}
|
||||||
|
|
||||||
Here are the C and Bison declarations for the reverse polish notation
|
Here are the C and Bison declarations for the reverse polish notation
|
||||||
@@ -1662,7 +1666,7 @@ therefore, @code{NUM} becomes a macro for @code{yylex} to use.
|
|||||||
The semantic value of the token (if it has one) is stored into the
|
The semantic value of the token (if it has one) is stored into the
|
||||||
global variable @code{yylval}, which is where the Bison parser will look
|
global variable @code{yylval}, which is where the Bison parser will look
|
||||||
for it. (The C data type of @code{yylval} is @code{YYSTYPE}, which was
|
for it. (The C data type of @code{yylval} is @code{YYSTYPE}, which was
|
||||||
defined at the beginning of the grammar; @pxref{Rpcalc Decls,
|
defined at the beginning of the grammar; @pxref{Rpcalc Declarations,
|
||||||
,Declarations for @code{rpcalc}}.)
|
,Declarations for @code{rpcalc}}.)
|
||||||
|
|
||||||
A token type code of zero is returned if the end-of-input is encountered.
|
A token type code of zero is returned if the end-of-input is encountered.
|
||||||
@@ -1758,7 +1762,7 @@ have not written any error rules in this example, so any invalid input will
|
|||||||
cause the calculator program to exit. This is not clean behavior for a
|
cause the calculator program to exit. This is not clean behavior for a
|
||||||
real calculator, but it is adequate for the first example.
|
real calculator, but it is adequate for the first example.
|
||||||
|
|
||||||
@node Rpcalc Gen
|
@node Rpcalc Generate
|
||||||
@subsection Running Bison to Make the Parser
|
@subsection Running Bison to Make the Parser
|
||||||
@cindex running Bison (introduction)
|
@cindex running Bison (introduction)
|
||||||
|
|
||||||
@@ -1977,12 +1981,12 @@ most of the work needed to use locations will be done in the lexical
|
|||||||
analyzer.
|
analyzer.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Decls: Ltcalc Decls. Bison and C declarations for ltcalc.
|
* Ltcalc Declarations:: Bison and C declarations for ltcalc.
|
||||||
* Rules: Ltcalc Rules. Grammar rules for ltcalc, with explanations.
|
* Ltcalc Rules:: Grammar rules for ltcalc, with explanations.
|
||||||
* Lexer: Ltcalc Lexer. The lexical analyzer.
|
* Ltcalc Lexer:: The lexical analyzer.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Ltcalc Decls
|
@node Ltcalc Declarations
|
||||||
@subsection Declarations for @code{ltcalc}
|
@subsection Declarations for @code{ltcalc}
|
||||||
|
|
||||||
The C and Bison declarations for the location tracking calculator are
|
The C and Bison declarations for the location tracking calculator are
|
||||||
@@ -2218,12 +2222,12 @@ $
|
|||||||
Note that multiple assignment and nested function calls are permitted.
|
Note that multiple assignment and nested function calls are permitted.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Decl: Mfcalc Decl. Bison declarations for multi-function calculator.
|
* Mfcalc Declarations:: Bison declarations for multi-function calculator.
|
||||||
* Rules: Mfcalc Rules. Grammar rules for the calculator.
|
* Mfcalc Rules:: Grammar rules for the calculator.
|
||||||
* Symtab: Mfcalc Symtab. Symbol table management subroutines.
|
* Mfcalc Symbol Table:: Symbol table management subroutines.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Mfcalc Decl
|
@node Mfcalc Declarations
|
||||||
@subsection Declarations for @code{mfcalc}
|
@subsection Declarations for @code{mfcalc}
|
||||||
|
|
||||||
Here are the C and Bison declarations for the multi-function calculator.
|
Here are the C and Bison declarations for the multi-function calculator.
|
||||||
@@ -2319,7 +2323,7 @@ exp: NUM @{ $$ = $1; @}
|
|||||||
%%
|
%%
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
@node Mfcalc Symtab
|
@node Mfcalc Symbol Table
|
||||||
@subsection The @code{mfcalc} Symbol Table
|
@subsection The @code{mfcalc} Symbol Table
|
||||||
@cindex symbol table example
|
@cindex symbol table example
|
||||||
|
|
||||||
@@ -2632,11 +2636,11 @@ As a @acronym{GNU} extension, @samp{//} introduces a comment that
|
|||||||
continues until end of line.
|
continues until end of line.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Prologue:: Syntax and usage of the prologue.
|
* Prologue:: Syntax and usage of the prologue.
|
||||||
* Prologue Alternatives:: Syntax and usage of alternatives to the prologue.
|
* Prologue Alternatives:: Syntax and usage of alternatives to the prologue.
|
||||||
* Bison Declarations:: Syntax and usage of the Bison declarations section.
|
* Bison Declarations:: Syntax and usage of the Bison declarations section.
|
||||||
* Grammar Rules:: Syntax and usage of the grammar rules section.
|
* Grammar Rules:: Syntax and usage of the grammar rules section.
|
||||||
* Epilogue:: Syntax and usage of the epilogue.
|
* Epilogue:: Syntax and usage of the epilogue.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Prologue
|
@node Prologue
|
||||||
@@ -5221,19 +5225,17 @@ identifier (aside from those in this manual) in an action or in epilogue
|
|||||||
in the grammar file, you are likely to run into trouble.
|
in the grammar file, you are likely to run into trouble.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Parser Function:: How to call @code{yyparse} and what it returns.
|
* Parser Function:: How to call @code{yyparse} and what it returns.
|
||||||
* Push Parser Function:: How to call @code{yypush_parse} and what it returns.
|
* Push Parser Function:: How to call @code{yypush_parse} and what it returns.
|
||||||
* Pull Parser Function:: How to call @code{yypull_parse} and what it returns.
|
* Pull Parser Function:: How to call @code{yypull_parse} and what it returns.
|
||||||
* Parser Create Function:: How to call @code{yypstate_new} and what it
|
* Parser Create Function:: How to call @code{yypstate_new} and what it returns.
|
||||||
returns.
|
* Parser Delete Function:: How to call @code{yypstate_delete} and what it returns.
|
||||||
* Parser Delete Function:: How to call @code{yypstate_delete} and what it
|
* Lexical:: You must supply a function @code{yylex}
|
||||||
returns.
|
which reads tokens.
|
||||||
* Lexical:: You must supply a function @code{yylex}
|
* Error Reporting:: You must supply a function @code{yyerror}.
|
||||||
which reads tokens.
|
* Action Features:: Special features for use in actions.
|
||||||
* Error Reporting:: You must supply a function @code{yyerror}.
|
* Internationalization:: How to let the parser speak in the user's
|
||||||
* Action Features:: Special features for use in actions.
|
native language.
|
||||||
* Internationalization:: How to let the parser speak in the user's
|
|
||||||
native language.
|
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Parser Function
|
@node Parser Function
|
||||||
@@ -5400,13 +5402,13 @@ that need it. @xref{Invocation, ,Invoking Bison}.
|
|||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Calling Convention:: How @code{yyparse} calls @code{yylex}.
|
* Calling Convention:: How @code{yyparse} calls @code{yylex}.
|
||||||
* Token Values:: How @code{yylex} must return the semantic value
|
* Token Values:: How @code{yylex} must return the semantic value
|
||||||
of the token it has read.
|
of the token it has read.
|
||||||
* Token Locations:: How @code{yylex} must return the text location
|
* Token Locations:: How @code{yylex} must return the text location
|
||||||
(line number, etc.) of the token, if the
|
(line number, etc.) of the token, if the
|
||||||
actions want that.
|
actions want that.
|
||||||
* Pure Calling:: How the calling convention differs
|
* Pure Calling:: How the calling convention differs in a pure parser
|
||||||
in a pure parser (@pxref{Pure Decl, ,A Pure (Reentrant) Parser}).
|
(@pxref{Pure Decl, ,A Pure (Reentrant) Parser}).
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Calling Convention
|
@node Calling Convention
|
||||||
@@ -6049,7 +6051,7 @@ This kind of parser is known in the literature as a bottom-up parser.
|
|||||||
* Contextual Precedence:: When an operator's precedence depends on context.
|
* Contextual Precedence:: When an operator's precedence depends on context.
|
||||||
* Parser States:: The parser is a finite-state-machine with stack.
|
* Parser States:: The parser is a finite-state-machine with stack.
|
||||||
* Reduce/Reduce:: When two rules are applicable in the same situation.
|
* Reduce/Reduce:: When two rules are applicable in the same situation.
|
||||||
* Mystery Conflicts:: Reduce/reduce conflicts that look unjustified.
|
* Mystery Conflicts:: Reduce/reduce conflicts that look unjustified.
|
||||||
* Generalized LR Parsing:: Parsing arbitrary context-free grammars.
|
* Generalized LR Parsing:: Parsing arbitrary context-free grammars.
|
||||||
* Memory Management:: What happens when memory is exhausted. How to avoid it.
|
* Memory Management:: What happens when memory is exhausted. How to avoid it.
|
||||||
@end menu
|
@end menu
|
||||||
@@ -7653,7 +7655,7 @@ standard I/O stream, the numeric code for the token type, and the token
|
|||||||
value (from @code{yylval}).
|
value (from @code{yylval}).
|
||||||
|
|
||||||
Here is an example of @code{YYPRINT} suitable for the multi-function
|
Here is an example of @code{YYPRINT} suitable for the multi-function
|
||||||
calculator (@pxref{Mfcalc Decl, ,Declarations for @code{mfcalc}}):
|
calculator (@pxref{Mfcalc Declarations, ,Declarations for @code{mfcalc}}):
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
%@{
|
%@{
|
||||||
@@ -8728,14 +8730,14 @@ main (int argc, char *argv[])
|
|||||||
@section Java Parsers
|
@section Java Parsers
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Java Bison Interface:: Asking for Java parser generation
|
* Java Bison Interface:: Asking for Java parser generation
|
||||||
* Java Semantic Values:: %type and %token vs. Java
|
* Java Semantic Values:: %type and %token vs. Java
|
||||||
* Java Location Values:: The position and location classes
|
* Java Location Values:: The position and location classes
|
||||||
* Java Parser Interface:: Instantiating and running the parser
|
* Java Parser Interface:: Instantiating and running the parser
|
||||||
* Java Scanner Interface:: Specifying the scanner for the parser
|
* Java Scanner Interface:: Specifying the scanner for the parser
|
||||||
* Java Action Features:: Special features for use in actions.
|
* Java Action Features:: Special features for use in actions
|
||||||
* Java Differences:: Differences between C/C++ and Java Grammars
|
* Java Differences:: Differences between C/C++ and Java Grammars
|
||||||
* Java Declarations Summary:: List of Bison declarations used with Java
|
* Java Declarations Summary:: List of Bison declarations used with Java
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Java Bison Interface
|
@node Java Bison Interface
|
||||||
@@ -10357,7 +10359,7 @@ grammatically indivisible. The piece of text it represents is a token.
|
|||||||
@c LocalWords: akim fn cp syncodeindex vr tp synindex dircategory direntry
|
@c LocalWords: akim fn cp syncodeindex vr tp synindex dircategory direntry
|
||||||
@c LocalWords: ifset vskip pt filll insertcopying sp ISBN Etienne Suvasa
|
@c LocalWords: ifset vskip pt filll insertcopying sp ISBN Etienne Suvasa
|
||||||
@c LocalWords: ifnottex yyparse detailmenu GLR RPN Calc var Decls Rpcalc
|
@c LocalWords: ifnottex yyparse detailmenu GLR RPN Calc var Decls Rpcalc
|
||||||
@c LocalWords: rpcalc Lexer Gen Comp Expr ltcalc mfcalc Decl Symtab yylex
|
@c LocalWords: rpcalc Lexer Expr ltcalc mfcalc yylex
|
||||||
@c LocalWords: yyerror pxref LR yylval cindex dfn LALR samp gpl BNF xref
|
@c LocalWords: yyerror pxref LR yylval cindex dfn LALR samp gpl BNF xref
|
||||||
@c LocalWords: const int paren ifnotinfo AC noindent emph expr stmt findex
|
@c LocalWords: const int paren ifnotinfo AC noindent emph expr stmt findex
|
||||||
@c LocalWords: glr YYSTYPE TYPENAME prog dprec printf decl init stmtMerge
|
@c LocalWords: glr YYSTYPE TYPENAME prog dprec printf decl init stmtMerge
|
||||||
|
|||||||
Reference in New Issue
Block a user