How to parse C-programs without communication between parser and lexer

Detlef Sodtke <sodtke@infbssts.ips.cs.tu-bs.de>
15 Aug 1996 17:38:32 -0400

          From comp.compilers

Related articles
How to parse C-programs without communication between parser and lexer sodtke@infbssts.ips.cs.tu-bs.de (Detlef Sodtke) (1996-08-15)
Re: How to parse C-programs without communication between parser and l henry@zoo.toronto.edu (Henry Spencer) (1996-08-16)
Re: How to parse C-programs without communication between parser and l scooter@mccabe.com (Scott Stanchfield) (1996-08-19)
How to parse C-programs without communication between parser and lexer ig@estar.msk.su (Ilfak Guilfanov) (1996-08-27)
| List of all articles for this month |

From: Detlef Sodtke <sodtke@infbssts.ips.cs.tu-bs.de>
Newsgroups: comp.compilers
Date: 15 Aug 1996 17:38:32 -0400
Organization: TU Braunschweig, Informatik (Bueltenweg), Germany
Keywords: C, parse, question, comment

Hello,


could anybody suggest books/papers/help about how to parse C-programs
without communication between the parser and the lexer.


The main problem is to distinguish the typedefnames from the normal
identifiers. The common way is, that the parser writes in a hashtable the
typedefnames and the lexer reads from it.


In our implementation we can't do it this way. We have to lex the whole
C-program before the parser starts to work. So the parser is not able to
write in a hashtable.


Does anybody know something that could help?


Detlef
[You really can't tell the difference between a typedef type name and a
variable name without some parser feedback, so I'd suggest that you make
your lexer treat any unrecognized word as a symbol and in your parser
fiddle with the syntax so that it can accept a symbol in the type position
and throw out the mistakes that accepts semantically. -John]
--


Post a followup to this message

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