bug-bison
[Top][All Lists]
Advanced

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

Re: Problem with multiple parsers


From: Akim Demaille
Subject: Re: Problem with multiple parsers
Date: Fri, 30 Jan 2015 14:40:02 +0100

> Le 30 janv. 2015 à 11:30, Laurence Finston <address@hidden> a écrit :
> 
> Hello,

Hi Laurence,

> I tried defining YY_DECL as you suggested, but I still couldn't get it to 
> work.  The program is already fairly complex so it's not easy to test just 
> the problem of getting multiple parsers to work together.  If I find the 
> time, I'll try to set up a minimal example.

yes, that would be nice.  Or if you have a tarball we could
have a look at.

> One problem is a `friend' declaration in a class declaration:
> 
> friend int yylex(YYSTYPE*, YYLTYPE*, yyscan_t);
> 
> (I'm generating C scanners and parsers and using them in a C++ program.)
> 
> Using `%name-prefix', this works for the other scanners (xxlex and zzlex), 
> too.  That is, this single `friend' declaration works for all three scanner 
> functions.

Yes, but is this really what you want?  You are giving
credential blindly to any scanner.  Shouldn't you just
pinpoint to the one you actually use?

friend int yylex(ZZSTYPE*, ZZLTYPE*, yyscan_t)

(I don't know for the last one, it is not under the control
of Bison).

> When I try to use `%define api.prefix', I get various errors pertaining to 
> YYSTYPE, YYLTYPE,

So far, so good.  You are mixing together different entities
with the same name, that's risky business.  So far, I consider
the api.prefix approach better.

> YY_DO_BEFORE_ACTION, YY_NEW_FILE, etc.

This, I don't understand.  It has nothing to do with Bison.

Are you sure your problem is with Bison and not flex?




reply via email to

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