help-bison
[Top][All Lists]
Advanced

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

Re: Selective Compilation


From: Tejas Kajarekar
Subject: Re: Selective Compilation
Date: Mon, 7 Feb 2011 15:43:32 -0500

Hi Martin,
If I understand your question correctly, here is a way to have multiple
scanners and parsers in the same program.

In Flex, you can use the --prefix = NEW_PREFIX. This will change the default
"yy" prefix to NEW_PREFIX, So yylex, yytext, yyout, etc., *including
yywrap()*, will change to NEW_PREFIXlex, NEW_PREFIXtext, etc. It will also
change the default output file name from lex.yy.c to lex.NEW_PREFIX.c.
Multiple flex programs can be linked together into same program.

In Bison, you will need -p NEW_PREFIX (or --name-NEW_PREFIX) option can be
used for the same purpose. This will rename most of the yyvariables and
yyfunctions to NEW_PREFIX variables and NEW_PREFIXfunctions. yyparse will
also be renamed to NEW_PREFIXparse.

tejasSK

On Mon, Feb 7, 2011 at 4:26 AM, John P. Hartmann <address@hidden>wrote:

> Use exclusive start conditions.  Have flex (or a wrapper) issue a token
> that
> is particular to the situation at hand.  Of course, you are carrying the
> overhead of larger tables.
>
> On 6 February 2011 14:39, Martin Alexander Neumann <
> address@hidden> wrote:
>
> > Hi,
> >
> > some time ago I designed a flex + bison system for an embedded system
> > for which I needed selective compilation -- different systems needed
> > different language subsets of my flex and bison files. I threw together
> > a solution using the C preprocessor to selective compile in only the
> > relevant stuff. It is working pretty well but how about a solution
> > natively integrated into flex and bison?
> >
> > Cheers, Martin
> >
> >
> > _______________________________________________
> > address@hidden http://lists.gnu.org/mailman/listinfo/help-bison
> >
> _______________________________________________
> address@hidden http://lists.gnu.org/mailman/listinfo/help-bison
>


reply via email to

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