problem with C grammar

"" <>
26 May 2006 01:36:51 -0400

          From comp.compilers

Related articles
problem with C grammar ( (2006-05-26)
Re: problem with C grammar (Ivan A. Kosarev) (2006-05-26)
Re: problem with C grammar (Hans-Peter Diettrich) (2006-05-30)
Re: problem with C grammar (Chris F Clark) (2006-05-30)
problem with C grammar (A.T.Hofkamp) (2006-05-30)
Re: problem with C grammar (Russ Cox) (2006-05-30)
Re: problem with C grammar (Ira Baxter) (2006-06-03)
[2 later articles]
| List of all articles for this month |

From: "" <>
Newsgroups: comp.compilers
Date: 26 May 2006 01:36:51 -0400
Keywords: C, parse, comment
Posted-Date: 26 May 2006 01:36:50 EDT


Actually, I wanted to use the following C grammar for a C parser:

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]

Post a followup to this message

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