[Top][All Lists]

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

Re: Propagation of prefix change in "yylval" name

From: Joel E. Denny
Subject: Re: Propagation of prefix change in "yylval" name
Date: Fri, 30 Apr 2010 11:01:40 -0400 (EDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

On Wed, 28 Apr 2010, Fran├žois PELLEGRINI wrote:

> In order to protect the parser I generate
> from collisions with third-party parsers,
> I use the "-p" and "-P" options, respectively :
> $ bison -pscotchyy -d -v parser_yy.y
> $ flex -Pscotchyy parser_ll.l
> However, as far as I have seen, I have to
> hard-code the changes in the parser code
> itself, which in my opinion should not be
> the case.

Are you saying you want to be able to change the value of the -p and -P 
flags without having to update any code in your .l and .y files?

> However, in file "parser_ll.l", where
> I wrote things such as :
> <lstrat>[0-9A-Za-z]         {
>                               strncpy (yylval.STRING, yytext, 
>                               yylval.STRING[PARSERSTRINGLEN - 1] = '\0';
>                               return (METHODNAME);
>                             }
> I have no way to know that "yylval" is
> no longer "yylval" but "scotchyylval" too.

Maybe you'd be happier with a pure parser so that scotchyylval is an 
argument to yylex rather than a global variable and thus needs no prefix.  
Search for "pure parser" in the Bison manual.

> Thanks for all the great job,
> A+,


reply via email to

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