bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: More FAQ


From: Akim Demaille
Subject: FYI: More FAQ
Date: Tue, 29 Apr 2003 11:57:32 +0200
User-agent: Gnus/5.090018 (Oort Gnus v0.18) Emacs/21.3 (gnu/linux)

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * doc/bison.texinfo (C++ Parsers, Implementing Loops): New.

Index: doc/bison.texinfo
===================================================================
RCS file: /cvsroot/bison/bison/doc/bison.texinfo,v
retrieving revision 1.105
diff -u -u -r1.105 bison.texinfo
--- doc/bison.texinfo 31 Mar 2003 07:10:44 -0000 1.105
+++ doc/bison.texinfo 29 Apr 2003 09:51:20 -0000
@@ -39,7 +39,7 @@
 This manual is for @acronym{GNU} Bison (version @value{VERSION},
 @value{UPDATED}), the @acronym{GNU} parser generator.
 
-Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, 2003,
+Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998,
 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
 @quotation
@@ -286,6 +286,8 @@
 * Parser Stack Overflow::      Breaking the Stack Limits
 * How Can I Reset @code{yyparse}::    @code{yyparse} Keeps some State
 * Strings are Destroyed::      @code{yylval} Loses Track of Strings
+* C++ Parsers::                Compiling Parsers with C++ Compilers
+* Implementing Loops::         Control Flow in the Calculator
 
 Copying This Manual
 
@@ -3495,7 +3497,7 @@
 Declare that the @var{code} must be invoked for each of the
 @var{symbols} that will be discarded by the parser.  The @var{code}
 should use @code{$$} to designate the semantic value associated to the
address@hidden  The additional parser parameters are also avaible
address@hidden  The additional parser parameters are also available
 (@pxref{Parser Function, , The Parser Function @code{yyparse}}).
 
 @strong{Warning:} as of Bison 1.875, this feature is still considered as
@@ -6356,6 +6358,8 @@
 * Parser Stack Overflow::      Breaking the Stack Limits
 * How Can I Reset @code{yyparse}::    @code{yyparse} Keeps some State
 * Strings are Destroyed::      @code{yylval} Loses Track of Strings
+* C++ Parsers::                Compiling Parsers with C++ Compilers
+* Implementing Loops::         Control Flow in the Calculator
 @end menu
 
 @node Parser Stack Overflow
@@ -6511,6 +6515,59 @@
 @end example
 
 
address@hidden C++ Parsers
address@hidden C++ Parsers
+
address@hidden
+How can I generate parsers in C++?
address@hidden display
+
+We are working on a C++ output for Bison, but unfortunately, for lack
+of time, the skeleton is not finished.  It is functional, but in
+numerous respects, it will require additional work which @emph{might}
+break backward compatibility.  Since the skeleton for C++ is not
+documented, we do not consider ourselves bound to this interface,
+nevertheless, as much as possible we will try to keep compatibility.
+
+Another possibility is to use the regular C parsers, and to compile
+them with a C++ compiler.  This works properly, provided that you bear
+some simple C++ rules in mind, such as not including ``real classes''
+(i.e., structure with constructors) in unions.  Therefore, in the
address@hidden, use pointers to classes, or better yet, a single
+pointer type to the root of your lexical/syntactic hierarchy.
+
+
address@hidden Implementing Loops
address@hidden Implementing Loops
+
address@hidden
+My simple calculator supports variables, assignments, and functions,
+but how can I implement loops?
address@hidden display
+
+Although very pedagogical, the examples included in the document blur
+the distinction to make between the parser ---whose job is to recover
+the structure of a text and to transmit it to subsequent modules of
+the program--- and the processing (such as the execution) of this
+structure.  This works well with so called straight line programs,
+i.e., precisely those that have a straightforward execution model:
+execute simple instructions one after the others.
+
address@hidden abstract syntax tree
address@hidden @acronym{AST}
+If you want a richer model, you will probably need to use the parser
+to construct a tree that does represent the structure it has
+recovered; this tree is usually called the @dfn{abstract syntax tree},
+or @address@hidden for short.  Then, walking through this tree,
+traversing it in various ways, will enable treatments such as its
+execution or its translation, which will result in an interpreter or a
+compiler.
+
+This topic is way beyond the scope of this manual, and the reader is
+invited to consult the dedicated literature.
+
+
+
 @c ================================================= Table of Symbols
 
 @node Table of Symbols
@@ -7052,3 +7109,33 @@
 @printindex cp
 
 @bye
+
address@hidden LocalWords: texinfo setfilename settitle setchapternewpage 
finalout
address@hidden LocalWords: ifinfo smallbook shorttitlepage titlepage GPL FIXME 
iftex
address@hidden LocalWords: akim fn cp syncodeindex vr tp synindex dircategory 
direntry
address@hidden LocalWords: ifset vskip pt filll insertcopying sp ISBN Etienne 
Suvasa
address@hidden LocalWords: ifnottex yyparse detailmenu GLR RPN Calc var Decls 
Rpcalc
address@hidden LocalWords: rpcalc Lexer Gen Comp Expr ltcalc mfcalc Decl Symtab 
yylex
address@hidden LocalWords: yyerror pxref LR yylval cindex dfn LALR samp gpl BNF 
xref
address@hidden LocalWords: const int paren ifnotinfo AC noindent emph expr stmt 
findex
address@hidden LocalWords: glr YYSTYPE TYPENAME prog dprec printf decl init 
stmtMerge
address@hidden LocalWords: pre STDC GNUC endif yy YY alloca lf stddef stdlib 
YYDEBUG
address@hidden LocalWords: NUM exp subsubsection kbd Ctrl ctype EOF getchar 
isdigit
address@hidden LocalWords: ungetc stdin scanf sc calc ulator ls lm cc NEG prec 
yyerrok
address@hidden LocalWords: longjmp fprintf stderr preg yylloc YYLTYPE cos ln
address@hidden LocalWords: smallexample symrec val tptr FNCT fnctptr func 
struct sym
address@hidden LocalWords: fnct putsym getsym fname arith fncts atan ptr malloc 
sizeof
address@hidden LocalWords: strlen strcpy fctn strcmp isalpha symbuf realloc 
isalnum
address@hidden LocalWords: ptypes itype YYPRINT trigraphs yytname expseq vindex 
dtype
address@hidden LocalWords: Rhs YYRHSLOC LE nonassoc op deffn typeless typefull 
yynerrs
address@hidden LocalWords: yychar yydebug msg YYNTOKENS YYNNTS YYNRULES 
YYNSTATES
address@hidden LocalWords: cparse clex deftypefun NE defmac YYACCEPT YYABORT 
param
address@hidden LocalWords: strncmp intval tindex lvalp locp llocp typealt 
YYBACKUP
address@hidden LocalWords: YYEMPTY YYRECOVERING yyclearin GE def UMINUS 
maybeword
address@hidden LocalWords: Johnstone Shamsa Sadaf Hussain Tomita TR uref 
YYMAXDEPTH
address@hidden LocalWords: YYINITDEPTH stmnts ref stmnt initdcl maybeasm VCG 
notype
address@hidden LocalWords: hexflag STR exdent itemset asis DYYDEBUG YYFPRINTF 
args
address@hidden LocalWords: YYPRINTF infile ypp yxx outfile itemx vcg tex 
leaderfill
address@hidden LocalWords: hbox hss hfill tt ly yyin fopen fclose ofirst gcc ll
address@hidden LocalWords: yyrestart nbar yytext fst snd osplit ntwo strdup AST
address@hidden LocalWords: YYSTACK DVI fdl printindex




reply via email to

[Prev in Thread] Current Thread [Next in Thread]