help-bison
[Top][All Lists]
Advanced

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

Re: yyerrok is missing in C++ parser


From: kogorman
Subject: Re: yyerrok is missing in C++ parser
Date: Sun, 17 Aug 2008 18:49:58 -0700 (PDT)

this patch made my parser and lexer compile.  thanks.  unfortunately, three
things
make it hard for me to investigate further at the moment.
 1. in the meantime, i've had hand surgery, and my typing is inaccurate and
laborious.
     the pain meds don't help, either.

 2. i'm working from a batch-mode example.  if i don't supply a file, it
simply quits.

 3. if i supply a file that should simply list usage and quit, it seg faults
instead.  i'm frankly daunted
     at the prospect of using gdb on this, but the backtrace shows something
to do with
     locations.  backtrace follows.  sources are also linked.

http://www.nabble.com/file/p19025133/six%252B%252B.tar six%2B%2B.tar 

address@hidden clsix++ $ gdb sixcl
GNU gdb 6.7.1
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) R file
Starting program: /home/kevin/Projects/clsix++/sixcl file

Program received signal SIGSEGV, Segmentation fault.
yylex (yylval_param=0xbfb6dca0, yylloc_param=0xbfb6dc3c, address@hidden)
at location.hh:75
75            begin = end;
(gdb) bt
#0  yylex (yylval_param=0xbfb6dca0, yylloc_param=0xbfb6dc3c,
address@hidden) at location.hh:75
#1  0x0804eadf in yy::sixcl_parser::parse (this=0xbfb6dce8) at
sixcl-parser.cc:326
#2  0x0804b602 in sixcl_driver::parse (this=0xbfb6dda4, address@hidden) at
sixcl-driver.cc:23
#3  0x0804b357 in main (argc=134577000, argv=0x8a7c1f8) at sixcl.cc:16
(gdb)  



i didn't want locations, particularly, but the extreme shortage of examples
has hedged
me in more than a little.  :,( <ire> frankly, i think this shortage is a
disservice to the project;
i would expect much better learning with a few complete lexer/parser
examples </ire>


Joel E. Denny-2 wrote:
> 
> On Tue, 12 Aug 2008, Laurence Finston wrote:
> 
>> On Mon, 11 Aug 2008, kogorman wrote:
>> 
>> > Nope,  I grep for yyerrok on all files in the directory, and see only
>> my own
>> > code and
>> > things directly generated from it.  I do not see a #define or other
>> > definiton.
> 
> Thanks for the report.
> 
> There are a few macros missing in this area.  The following patch should 
> fix this.  It's perhaps not the C++ way to do things because it uses 
> #define, but I see no simple alternative given that yyerrstatus_ and 
> yychar are local to the parse function.
> 
> I'm in a hurry and haven't yet tested the patch.  Would you please let me 
> know if it works for you?  Just copy and paste the new code into either 
> the lalr1.cc skeleton file or into your Bison-generated parser source 
> code.  You can paste it right above the YYACCEPT definition.
> 
> diff --git a/data/lalr1.cc b/data/lalr1.cc
> index 7ecc525..cbb5949 100644
> --- a/data/lalr1.cc
> +++ b/data/lalr1.cc
> @@ -367,6 +367,10 @@ do {                                     \
>  
>  #endif /* !YYDEBUG */
>  
> +#define yyerrok         (yyerrstatus_ = 0)
> +#define yyclearin       (yychar = yyempty_)
> +#define YYRECOVERING()  (!!yyerrstatus_)
> +
>  #define YYACCEPT     goto yyacceptlab
>  #define YYABORT              goto yyabortlab
>  #define YYERROR              goto yyerrorlab
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/yyerrok-is-missing-in-C%2B%2B-parser-tp18919947p19025133.html
Sent from the Gnu - Bison - Help mailing list archive at Nabble.com.





reply via email to

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