Re: Lexical feedback

Mitchell Perilstein <>
Fri, 29 Sep 1995 04:23:26 GMT

          From comp.compilers

Related articles
Lexical feedback (Paul Long) (1995-09-22)
Re: Lexical feedback (Mitchell Perilstein) (1995-09-29)
Re: Lexical feedback (Paul Long) (1995-10-06)
Lexical feedback 75066.3204@CompuServe.COM (Carl Barron) (1995-10-21)
Re: Lexical feedback (Richard Pennington) (1995-10-22)
Re: Lexical feedback (1995-10-23)
Re: Lexical feedback (1995-10-25)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Mitchell Perilstein <>
Keywords: parse, yacc, comment
Organization: Compilers Central
References: 95-09-143
Date: Fri, 29 Sep 1995 04:23:26 GMT

What's wrong with the parser communicating its state to the lexer at the
same time it asks the lexer for the next token?

I'm about to do exactly this for a C-like language that has its own
macro processor. Some of the macros are only valid in certain contexts.
If I pass a little context information to lex from the parser, all the
macros can be handled by lex. Fortunately, this is a by-hand lex and
parser; who knows how to teach lex and yacc this trick without globals?

What are the reasons for your hesitation?

  Mitchell N. Perilstein [\]
  COMPASS Design Automation, Columbia MD USA
  Tel: 410-992-5700 x1225, Fax: 410-992-3536
[Don't forget that yacc can be reading a token ahead of where it's parsing.
That makes lexical feedback more exciting. -John]

Post a followup to this message

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