help-bison
[Top][All Lists]
Advanced

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

Re: reentrant flex, bison glue


From: John W. Millaway
Subject: Re: reentrant flex, bison glue
Date: Thu, 14 Mar 2002 12:13:27 -0800 (PST)

> I'm very worried when I see two packages having an increased
> impedance.

I've only done what was ALREADY IN BISON! Below is code from bison, followed by
code from flex:

/***** GENERATED BY BISON  *****/
/* Automatic implicit declaration of yylex. [Comment added by millaway] */
#ifndef YYPURE
#define YYLEX       yylex()
#endif
#ifdef YYPURE
#ifdef YYLSP_NEEDED
#ifdef YYLEX_PARAM
#define YYLEX       yylex(&yylval, &yylloc, YYLEX_PARAM)
#else
#define YYLEX       yylex(&yylval, &yylloc)
#endif
#else /* not YYLSP_NEEDED */
#ifdef YYLEX_PARAM
#define YYLEX       yylex(&yylval, YYLEX_PARAM)
#else
#define YYLEX       yylex(&yylval)
#endif
#endif /* not YYLSP_NEEDED */
#endif


/**** GENERATED BY FLEX *****/
/* Automatic explicit declaration of yylex. */
#ifdef YY_REENTRANT_BISON_PURE
#  ifdef YYLTYPE 
#    ifdef YY_USE_PROTOS
#      define YY_LEX_ARGS (YYSTYPE * yylvalp, YYLTYPE * yyllocp YY_LAST_ARG)
#    else
#      define YY_LEX_ARGS (yylvalp, yyllocp YY_LAST_ARG) \
                   YYSTYPE * yylvalp; YYLTYPE * yyllocp; YY_DECL_LAST_ARG
#    endif
#  else
#    ifdef YY_USE_PROTOS
#      define YY_LEX_ARGS (YYSTYPE * yylvalp YY_LAST_ARG)
#    else
#      define YY_LEX_ARGS (yylvalp YY_LAST_ARG) \
                             YYSTYPE * yylvalp; YY_DECL_LAST_ARG
#    endif
#  endif
#else
#  ifdef YY_USE_PROTOS
#    define YY_LEX_ARGS (YY_ONLY_ARG)
#  else
#    define YY_LEX_ARGS (YY_ONLY_ARG) YY_DECL_LAST_ARG
#  endif
#endif
extern int yylex YY_PROTO( YY_LEX_ARGS );



> >> I also guess you can't use this feature when you renamed yy to foo? 
> >> (I mean, using Bison's --name-prefix, not Flex's equivalent
> >> option).
> John> No, look in the flex tests/ directory. The bison glue examples
> John> use the prefix "test" or something like that.
> 
> How does Flex knows under what name yylval and yylloc are exported
> from Bison???

They aren't exported at all. They are passed as agruments to yylex. Therefore,
flex can name them whatever it wants to. I chose to name them "yylval" and
"yylloc" because that's what Bison names them.


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/



reply via email to

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