Re: How do I implement check_type() ?

Hans-Peter Diettrich <DrDiettrich1@aol.com>
Mon, 25 May 2009 09:39:37 +0200

          From comp.compilers

Related articles
How do I implement check_type() ? seescreen@gmail.com (2009-05-22)
Re: How do I implement check_type() ? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2009-05-25)
Re: How do I implement check_type() ? m.helvensteijn@gmail.com (Michiel Helvensteijn) (2009-05-25)
| List of all articles for this month |
From: Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups: comp.compilers
Date: Mon, 25 May 2009 09:39:37 +0200
Organization: Compilers Central
References: 09-05-108
Keywords: C++, parse
Posted-Date: 25 May 2009 05:08:00 EDT

seescreen@gmail.com schrieb:


> In the case of this project I need to return TYPE_NAME from the lexer
> whenever I encounter a Class name. The problem seems to be that only
> the parser knows whether or not the IDENTIFIER is a class name or not,
> and yet the lexer sees the name before it goes to the parser.
>
> What is the simplest way to get around this problem?


I'd create a list of type names, maintained by the parser, then the
lexer can lookup all identifiers in that list.


When you include the preprocessor (what's unlikely when using lex/yacc
;-) then the name mapping has to occur somewhere betweeen the lexer and
the parser, after macro expansion.


DoDi



Post a followup to this message

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