bug-bison
[Top][All Lists]
Advanced

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

Improvements for the C++ tutorial?


From: Markus Elfring
Subject: Improvements for the C++ tutorial?
Date: Sat, 28 Sep 2013 14:20:25 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0

Hello,

I have found a few update candidates in the C++ tutorial.
http://git.savannah.gnu.org/cgit/bison.git/tree/doc/bison.texi?id=45c64fa627f205f49ac7afb51ad3d6e851b62f86#n10952
http://www.gnu.org/software/bison/manual/html_node/A-Complete-C_002b_002b-Example.html

1. I would prefer to place the source code for "YY_DECL;" below the declaration
of the class "calcxx_driver".

   Would it also make sense to turn the shown function "yylex" into a member
function?

2. How do you think about to make the member functions which are used for the
coordination with the Flex scanner private?
   (The needed access can also be "restored" by a statement like "friend class
yy::my_parser" here, can't it?)

3. Should the function "parse" throw C++ exceptions eventually instead of
returning an integer value?

4. I needed to add the following statements during my bison experiments so that
the function "scan_begin" will work.
   extern int yy_flex_debug;
   extern FILE* yyin;

   How are the chances to change such dependencies on global variables?

5. I find that the shown token list does not fit to the description in the
section "Token Type Names".
   ...
   ASSIGN  ":="
   ...
   RPAREN  ")"
   ;

6. Does the function "yyerror" need also be declared and implemented for
corresponding error reporting here?

7. I had "start difficulties" to interpret the wording "The Flex scanner first
includes the driver declaration ..." in the section "10.1.6.4 Calc++ Scanner"
that a new file should be created with the suffix ".l".

Regards,
Markus



reply via email to

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