Passing a parameter to yylex thru yyparse

"Gwenakl Lambrouin" <>
29 Apr 1998 22:34:58 -0400

          From comp.compilers

Related articles
Passing a parameter to yylex thru yyparse (Gwenakl Lambrouin) (1998-04-29)
| List of all articles for this month |

From: "Gwenakl Lambrouin" <>
Newsgroups: comp.compilers
Date: 29 Apr 1998 22:34:58 -0400
Organization: Cincom Systems, Inc., Cincinnati OH
Keywords: lex, question, comment


I'm writing a parser using Bison 1.2.4 and Flex 2.5.1.

I'm calling yyparse from a C function, and I'd like to pass a parameter
(void*) to yylex. I want yylex to set up my parameter while scanning. I
don't want the parameter to be global.

So I've got to pass the parameter to yyparse, and then yyparse has to
pass it to yylex.
I don't know if it's possible to do so, without modifying to much the
generated parser. If possible, I'd like to modify only the grammar file.

Thanks for any help.

GwenaŽl Lambrouin
[Considering the enormous amount of state that lex keeps in static data,
I don't see why one more word of static info is a problem. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.