two (or more) lex's/yacc's in one executable

Doug Gwyn gwyn at smoke.brl.mil
Fri Dec 7 09:43:30 AEST 1990


In article <1990Dec6.200944.13037 at cs.columbia.edu>, leland at cs writes:
- I've tried this kludge:  create a header file that re-#define's all the
- names 'yyfoo' in lex/yacc set #1 to be named, say, set1yyfoo, and all
- those in set #2 to be named set2yyfoo.  This has worked for me in the
- past, but won't in this particular instance because the generated
- code includes calls to yyless() and yywrap(), which are in the LEX
- library (-ll), the contents of which I cannot rename.  So that doesn't
- work.

But it almost does -- Since "lex" produces C source, you can #define
set1yyless yyless, etc. before the lex output to be compiled, thereby
turning these selected reference back into calls to the shared library
functions.  (I assume the lex library does not maintain internal state.)



More information about the Comp.lang.c mailing list