help-bison
[Top][All Lists]
Advanced

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

Re: Multiple Parsers in the Same Program


From: Patrick Bellasi
Subject: Re: Multiple Parsers in the Same Program
Date: Sat, 4 Sep 2004 21:10:19 +0000
User-agent: KMail/1.6.2

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi again to all,
        I'm still here since I've found the solution of my doubt...


> Hi guys!!!
>
>       I've solved... but I can't explain to myself the reason for the solution
> I've found...

Well, looking inside the code of the generated parser (namely first_pars.c ), 
if we use the directive %name-prefix="first_", we find that:

/* If NAME_PREFIX is specified substitute the variables and functions
   names.  */
#define yyparse first_parse
#define yylex   first_lex
#define yyerror first_error
#define yylval  first_lval
#define yychar  first_char
#define yydebug first_debug
#define yynerrs first_nerrs

so, in the following code:

> this instead doesn't work!!!
>
> > That is:
> >
> > first_lex() {
> >     return yylex();
> > }
> >
> > and
> >
> > second_lex() {
> >     return yylex();
> > }


yylex() is just an alias fot first_lex()... that means endless loop!!!
This is the reason for the infinite growing of the stack (as seen by dgb's 
bt )... and the final SEGMENTATION FAULT!

to the next,
        Patrick


- -- 



<---------------------------------------------------------------------------------------------------------->
                                                  DERKLING
                                    LRU 338214 (http://counter.li.org)

  #include <best/regards.h>


<---------------------------------------------------------------------------------------------------------->
   Patrick Bellasi <derkling_at_users.sourceforge.net>
   Student (Politecnico di Milano)
       Comp.Sci & Soft.Eng
   
   Contacts:
    - Room +39 02 23952621
    - Home +39 0342 621043 (week-ends)
    - ICQ   344672588
    - MSN   address@hidden
   
   Privacy:
    - PGP   0x72ABC1EE (www.keyserver.net)
      pub  1024D/72ABC1EE 2003-12-04 Patrick Bellasi (PGP key for poste.it) 
<address@hidden>
      Primary key fingerprint: 3958 7B5F 36EC D1F8 C752  9589 C3B7 FD49 72AB 
C1EE
<---------------------------------------------------------------------------------------------------------->
   
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBOi9CeGk3pQ7APA8RAvA1AJ9YWGl+XiedtYSlBW37oFpu7nxC/wCfYP+J
N/esl6yXkdLVCBx5OFDL6U0=
=Q8wP
-----END PGP SIGNATURE-----




reply via email to

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