Really update refcard.tex...

This commit is contained in:
Akim Demaille
2001-11-02 17:20:22 +00:00
parent 6468d18e5c
commit 92fcb5efbe

View File

@@ -6,7 +6,7 @@
% This file can be printed with 1 or 2 columns per page (see below). % This file can be printed with 1 or 2 columns per page (see below).
% Specify how many you want here. Nothing else needs to be changed % Specify how many you want here. Nothing else needs to be changed
% unless you are maintaining the documentation. % unless you are maintaining the documentation.
% For printing reference cards to use in books, specify one column % For printing reference cards to use in books, specify one column
% per page and reduce to 80%. % per page and reduce to 80%.
% Note that if columnsperpage is set to 2, there will be a few overfull % Note that if columnsperpage is set to 2, there will be a few overfull
% boxes, but they are not serious. Just uncomment \finalout. % boxes, but they are not serious. Just uncomment \finalout.
@@ -19,7 +19,7 @@
\def\finalout{\overfullrule=0pt} \def\finalout{\overfullrule=0pt}
%\finalout %\finalout
% Copyright (c) 1998 Free Software Foundation, Inc. % Copyright (c) 1998, 2001 Free Software Foundation, Inc.
% %
% This file is part of Bison. % This file is part of Bison.
% %
@@ -51,11 +51,11 @@
% Which mode to use is controlled by setting \columnsperpage above. % Which mode to use is controlled by setting \columnsperpage above.
% %
% Authors: % Authors:
% Brendan Kehoe % Brendan Kehoe
% UUCP: widener!brendan % UUCP: widener!brendan
% Internet: brendan@cs.widener.edu % Internet: brendan@cs.widener.edu
% %
% Gavin Nicol % Gavin Nicol
% Internet: nick@nsis.cl.co.jp % Internet: nick@nsis.cl.co.jp
% %
% This refcard format was created by Steve Gildea. % This refcard format was created by Steve Gildea.
@@ -66,12 +66,12 @@
% We only change the following to change the version numbers and % We only change the following to change the version numbers and
% such. % such.
\def\bisonversion{1.20} % the bison version \def\bisonversion{1.31} % the bison version
\def\refcardversion{0.4a} % reference card version \def\refcardversion{0.5} % reference card version
\def\month{August} % month \def\month{November} % month
\def\year{1998} % year \def\year{2001} % year
\def\version{\month\ \year, Bison Refcard Version \refcardversion} \def\version{\month\ \year, Bison Refcard Version \refcardversion}
% for copyright notices % for copyright notices
\def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip} \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
@@ -90,7 +90,7 @@
Permission is granted to make and distribute copies of this card Permission is granted to make and distribute copies of this card
provided the copyright notice and this permission notice provided the copyright notice and this permission notice
are preserved on all copies. are preserved on all copies.
\vskip .2\baselineskip \vskip .2\baselineskip
For information, write to the: For information, write to the:
\vskip .2\baselineskip \vskip .2\baselineskip
@@ -115,7 +115,7 @@ For information, write to the:
Permission is granted to make and distribute copies of this card Permission is granted to make and distribute copies of this card
provided the copyright notice and this permission notice provided the copyright notice and this permission notice
are preserved on all copies. are preserved on all copies.
\vskip .2\baselineskip \vskip .2\baselineskip
For information, write to the: For information, write to the:
\vskip .2\baselineskip \vskip .2\baselineskip
@@ -136,7 +136,7 @@ For information, write to the:
\def\ncolumns{\the\columnsperpage} \def\ncolumns{\the\columnsperpage}
\message{[\ncolumns\space \message{[\ncolumns\space
column\if 1\ncolumns\else s\fi\space per page]} column\if 1\ncolumns\else s\fi\space per page]}
\def\scaledmag#1{ scaled \magstep #1} \def\scaledmag#1{ scaled \magstep #1}
@@ -227,7 +227,7 @@ For information, write to the:
\def\bye{\par\vfill\supereject \def\bye{\par\vfill\supereject
\if a\abc \else\null\vfill\eject\fi \if a\abc \else\null\vfill\eject\fi
\if a\abc \else\null\vfill\eject\fi \if a\abc \else\null\vfill\eject\fi
\end} \end}
\fi \fi
% we won't be using math mode much, so redefine some of the characters % we won't be using math mode much, so redefine some of the characters
@@ -316,41 +316,44 @@ Options can be used as: \kbd{bison {\it options} {\it filename}}
\section{Command Line Options} \section{Command Line Options}
%***************************** %*****************************
\key{Display usage information.} {-h}
\key{Display version information.} {-V}
\key{Generate token and {\tt YYSTYPE} definitions.} {-d} \key{Generate token and {\tt YYSTYPE} definitions.} {-d}
\key{Prepend a prefix to external symbols.} {-p {\it prefix}}
\key{Don't put {\tt \#line} directives in the parser.} {-l} \key{Don't put {\tt \#line} directives in the parser.} {-l}
\key{Specify the output file.} {-o {\it filename}} \key{Specify the output file.} {-o {\it filename}}
\key{Debug or {\it trace} mode.} {-t} \key{Debug or {\it trace} mode.} {-t}
\key{Verbose description of the parser.} {-v} \key{Verbose description of the parser.} {-v}
\key{Emulate {\tt yacc} (generate {\tt y.tab.*} files).} {-y} \key{Emulate {\tt yacc} (generate {\tt y.tab.*} files).} {-y}
\vskip .10truein \vskip .10truein
{\bf Note:} The token and {\tt YYSTYPE} definitions are generated {\bf Note:} The token and {\tt YYSTYPE} definitions are generated
to a file called {\tt y.tab.h} if the {\tt -y} option is used, to a file called {\tt y.tab.h} if the {\tt -y} option is used,
otherwise it will have the format {\tt {\it name}.tab.h}, where otherwise it will have the format {\tt {\it name}.tab.h}, where
{\it name} is the leading part of the parser definition filename. {\it name} is the leading part of the parser definition filename.
\section{Definitions} \section{Definitions}
%******************** %********************
\key{Declare a terminal symbol.}{\%token <{\it t\/}> \key{Declare a terminal symbol.}{\%token <{\it t\/}>
{\it n}} {\it n}}
\key{Declare a terminal symbol, and define its association.} \key{Declare a terminal symbol, and define its association.}
{{\it association} <{\it t\/}> {\it n}} {{\it association} <{\it t\/}> {\it n}}
\vskip .2\baselineskip \vskip .2\baselineskip
\key{Generate a reentrant (pure) parser.} \key{Generate a reentrant (pure) parser.}
{\%pure_parser} {\%pure_parser}
\key{Define the union of all data types used in the parser.} \key{Define the union of all data types used in the parser.}
{\%union\{{\it field list}\} } {\%union\{{\it field list}\} }
\vskip .2\baselineskip \vskip .2\baselineskip
\key{Tell {\tt bison} where to start parsing.} \key{Tell {\tt bison} where to start parsing.}
{\%start {\it m}} {\%start {\it m}}
\key{Tell {\tt bison} the data type of symbols.} \key{Tell {\tt bison} the data type of symbols.}
{\%type <{\it t\/}> {\it s1}\dots{\it sn}} {\%type <{\it t\/}> {\it s1}\dots{\it sn}}
\vskip .10truein \vskip .10truein
@@ -362,8 +365,8 @@ definition, {\it n} is a {\it terminal} symbol name, {\it m} is a
\vskip .10truein \vskip .10truein
The {\tt <{\it t\/}>} after {\tt \%token, \%left, \%right} and {\tt The {\tt <{\it t\/}>} after {\tt \%token, \%left, \%right} and {\tt
\%nonassoc} is optional. Additionally, precedence may be overridden with \%nonassoc} is optional. Additionally, precedence may be overridden
embedded {\tt \%prec} commands. in the rules with {\tt \%prec} commands.
\section{Parser Definition Files} \section{Parser Definition Files}
%********************************* %*********************************
@@ -379,7 +382,7 @@ The general form for a parser definition is:
\%\% \%\%
Rule definition 1 Rule definition 1
\vdots \vdots
Rule definition {\it n} Rule definition {\it n}
@@ -397,8 +400,9 @@ The general form for a parser definition is:
Rules take the form: Rules take the form:
\vskip -\baselineskip
\beginexample \beginexample
non-terminal : {\it statement} 1 non-terminal : {\it statement} 1
| {\it statement} 2 | {\it statement} 2
\vdots \vdots
| {\it statement n} | {\it statement n}
@@ -406,12 +410,12 @@ Rules take the form:
\endexample \endexample
Where {\it statements} can be either empty, or contain Where {\it statements} can be either empty, or contain
a mixture of C code (enclosed in {\tt \{...\}}), and the a mixture of C code (enclosed in {\tt \{...\}}), and the
symbols that make up the non-terminal. For example: symbols that make up the non-terminal. For example:
\vskip -\baselineskip \vskip -\baselineskip
\beginexample \beginexample
expression : number '$+$' number \{ \$\$ $=$ \$1 $+$ \$3 \} expression : number '$+$' number \{ \$\$ $=$ \$1 $+$ \$3 \}
| number '$-$' number \{ \$\$ $=$ \$1 $-$ \$3 \} | number '$-$' number \{ \$\$ $=$ \$1 $-$ \$3 \}
| number '$/$' number \{ \$\$ $=$ \$1 $/$ \$3 \} | number '$/$' number \{ \$\$ $=$ \$1 $/$ \$3 \}
| number '$*$' number \{ \$\$ $=$ \$1 $*$ \$3 \} | number '$*$' number \{ \$\$ $=$ \$1 $*$ \$3 \}
@@ -428,7 +432,7 @@ For altering the precedence of a symbol use:
For example: For example:
\vskip -\baselineskip \vskip -\baselineskip
\beginexample \beginexample
foo : gnu bar gnu \%prec bar foo : gnu bar gnu \%prec bar
; ;
\endexample \endexample
@@ -438,16 +442,18 @@ For example:
\key{Recognize an error \& continue parsing.}{error} \key{Recognize an error \& continue parsing.}{error}
\key{Access data associated with a symbol.} {\$\$, \$0\dots\${\it n}} \key{Access data associated with a symbol.} {\$\$, \$0\dots\${\it n}}
\key{Access a field of the data union.} {\$\$.{\it t}, \key{Access a field of the data union.} {\$\$.{\it t},
\$0.{\it t}\dots\${\it n}.{\it t}} \$0.{\it t}\dots\${\it n}.{\it t}}
\key{Access data's line position.} {@{\it n}.{\it line\_spec}} \key{Access symbol's location.} {@\$, @0\dots@{\it n}}
\key{Access data's column position.} {@{\it n}.{\it column\_spec}} \key{Access data's line location.} {@{\it x}.{\it line\_spec}}
\key{Access data's column location.} {@{\it x}.{\it column\_spec}}
\vskip .10truein \vskip .10truein
%
Where {\it t} is a type defined in the {\tt \%union}, {\it n} is a Where {\it t} is a type defined in the {\tt \%union}, {\it n} is a
number, {\it line\_spec} one of {\tt first_line} and {\tt last_line}, number, {\it x} is a number or \$, {\it line\_spec} one of {\tt
and {\it column\_spec} is specified as either {\tt first_column} or {\tt first_line} and {\tt last_line}, and {\it column\_spec} is specified
last_column}. as either {\tt first_column} or {\tt last_column}.
\section {Variables and Types} \section {Variables and Types}
%***************************** %*****************************