[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: two yyparse() functions in the same program
From: |
Laurence Finston |
Subject: |
Re: two yyparse() functions in the same program |
Date: |
Mon, 4 Aug 2008 12:41:24 +0200 (CEST) |
On Sat, 2 Aug 2008, george smith wrote:
> Hello,
> I am building a compiler where i need a parser for the front end and another
> one for the back end. So i will need two parsers in the same program
> but there will be a conflict between the function names as with the global
> variables. Is there any way to change the names to resolve any conficts?
> Thanks in advance
> George.
> _______________________________________________
As already mentioned, there's a `-p' option for this purpose, which is
equivalent to the `%name-prefix' option you can use in your input file.
This topic is documented in the Bison manual. I'm not sure whether you
need to make the parsers reentrant in order to avoid name conflicts, but I
recommend doing so, anyway.
You can find an example of using two parsers in a single program here:
http://cvs.savannah.gnu.org/viewvc/metaexchange/scantest/?root=metaexchange
The code for one is in `dbcrprsr.w' and the other in `parser.w'. Both
functions are called in `main.web'.
I haven't touched this code in a long time, but it worked the last time I
did.
Laurence Finston