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) |
[2 later articles] |
From: | "the.malfunction@googlemail.com" <the.malfunction@googlemail.com> |
Newsgroups: | comp.compilers |
Date: | 26 May 2006 01:36:51 -0400 |
Organization: | http://groups.google.com |
Keywords: | C, parse, comment |
Posted-Date: | 26 May 2006 01:36:50 EDT |
Hi,
Actually, I wanted to use the following C grammar for a C parser:
http://kbs.cs.tu-berlin.de/~jutta/c/ANSI-C-grammar-y.html
There is a derivation from the non-terminal symbol "type_specifier" to
the terminal symbol "TYPE_NAME". I tried to replace that terminal with
IDENTIFIER, but then i got a lot of shift/reduce and reduce/reduce
conflicts while using bison:
C:\>bison -l -d --report=solved test_grammar.y
test_grammar.y: Konflikte: 6 Schiebe/Reduziere, 32 Reduziere/Reduziere
test_grammar.y:304.11-20: Warnung: Regel nie reduziert wegen
Konflikten: identifier_list: IDENTIFIER
(sorry, I only have a german version of bison)
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. 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]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.