|Lexical feedback email@example.com (Paul Long) (1995-09-22)|
|Re: Lexical feedback firstname.lastname@example.org (Mitchell Perilstein) (1995-09-29)|
|Re: Lexical feedback email@example.com (Paul Long) (1995-10-06)|
|Lexical feedback 75066.3204@CompuServe.COM (Carl Barron) (1995-10-21)|
|Re: Lexical feedback firstname.lastname@example.org (Richard Pennington) (1995-10-22)|
|Re: Lexical feedback email@example.com (1995-10-23)|
|Re: Lexical feedback firstname.lastname@example.org (1995-10-25)|
|From:||Paul Long <email@example.com>|
|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
Return to the
Search the comp.compilers archives again.