Lexical feedback

Paul Long <plong@perf.com>
Fri, 22 Sep 1995 19:12:54 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: Paul Long <plong@perf.com>
Keywords: lex, question
Organization: Performance Computing Incorporated
Date: Fri, 22 Sep 1995 19:12:54 GMT

I took the title of this article from a section in our moderator's
book, _lex & yacc_. I need a more robust approach than the ones he
describes for a yacc-generated parser controlling a lex-generated
lexer. My problem, which I'm sure many of you have had to solve, is
recognizing lexemes as typedef names in only _certain_ contexts in
the C grammar; otherwise, they are recognized as simple identifiers.
My grammar is based on the one published in the Standard. All of the
solutions that I've come up with end up as pretty bad hacks.

I see two general approaches: 1. have the parser communicate its
context to the lexer, avoiding any lookahead problems that may crop
up, and 2. modifying the grammar so that the parser decides through
semantic analysis whether a lexeme is a typedef name and somehow
resolving the resulting syntactical ambiguities.

Paul Long 45:29:14N 122:48:09W
plong@perf.com http://www.teleport.com/~pciwww/

Post a followup to this message

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