Lexical feedback

Carl Barron <75066.3204@CompuServe.COM>
Sat, 21 Oct 1995 07:24:20 GMT

          From comp.compilers

Related articles
Lexical feedback plong@perf.com (Paul Long) (1995-09-22)
Re: Lexical feedback mnp@compass-da.com (Mitchell Perilstein) (1995-09-29)
Re: Lexical feedback plong@perf.com (Paul Long) (1995-10-06)
Lexical feedback 75066.3204@CompuServe.COM (Carl Barron) (1995-10-21)
Re: Lexical feedback rich@rdp.introl.com (Richard Pennington) (1995-10-22)
Re: Lexical feedback pardo@cs.washington.edu (1995-10-23)
Re: Lexical feedback vern@daffy.ee.lbl.gov (1995-10-25)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Carl Barron <75066.3204@CompuServe.COM>
Keywords: parse, lex, yacc
Organization: CompuServe, Inc. (1-800-689-0736)
References: 95-09-143 95-10-032
Date: Sat, 21 Oct 1995 07:24:20 GMT

  > Who knows how to teach yacc and lex to communicate without globals.

  I use static globals, when needed.

        If I really want it only available for lex and yacc. A static global
in a %{ %} section at the top of the yacc file and a #include "lex.yy.c"
in the final C section of the yacc file does it easily. if you don't
mind a copy of lex.yy.c being kept.

      I usually use a header file containing a wrapper macro that
defines a readable function name into some strange name function only
when a preprocessor constant is defined, otherwise the macro expands
to nothing or 0. using a static global in the intial C section of
the lex file and a short function in the final C section, makes the
communication one way and controlled better than a straight global
access would.

Post a followup to this message

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