Related articles |
---|
problem with C grammar the.malfunction@googlemail.com (the.malfunction@googlemail.com) (2006-05-26) |
Re: problem with C grammar ik@unicals.com (Ivan A. Kosarev) (2006-05-26) |
Re: problem with C grammar DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-05-30) |
Re: problem with C grammar cfc@shell01.TheWorld.com (Chris F Clark) (2006-05-30) |
problem with C grammar a.t.hofkamp@tue.nl (A.T.Hofkamp) (2006-05-30) |
Re: problem with C grammar rsc@swtch.com (Russ Cox) (2006-05-30) |
Re: problem with C grammar idbaxter@semdesigns.com (Ira Baxter) (2006-06-03) |
Re: problem with C grammar hebisch@math.uni.wroc.pl (Waldek Hebisch) (2006-06-03) |
Re: problem with C grammar mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2006-06-05) |
From: | Hans-Peter Diettrich <DrDiettrich@compuserve.de> |
Newsgroups: | comp.compilers |
Date: | 30 May 2006 18:38:36 -0400 |
Organization: | Compilers Central |
References: | 06-05-078 |
Keywords: | C, syntax |
Posted-Date: | 30 May 2006 18:38:36 EDT |
"the.malfunction@googlemail.com" wrote:
> As it seems, the lexical scanner is proposed to analyse whether an
> identifier is a type or not. I rather would like to let the parser do
> this job.
The handling of symbols is a complex thing in C. Lately I've written an
LL(1) parser for C, where a global symbol table classifies all names
into keywords, macros and identifiers, and further classifies global
identifiers as names of types, (enumerated) constants etc. Since in C
all typenames have global scope, the implementation of such a
classification is not very complicated.
> Is there any way to change the grammar such that I can use
> IDENTIFIER instead of TYPE_NAME here without having all those conflicts?
> [This is the hardest part of parsing C. -John]
In C++ I suspect more problems with namespaces, which prevent the use of
a common global STB.
DoDi
Return to the
comp.compilers page.
Search the
comp.compilers archives again.