Re: ANSI C grammar without shift-reduce conflict on 'ELSE'



Rares GalaN wrote:

I'm trying to use the ANSI C Grammar from
http://www.lysator.liu.se/c/ANSI-C-grammar-y.html and I'm getting a
"shift - reduce on ELSE" error. I'm quite new with this, so it would
really be useful if I could get a grammar that's conflict free. Any
suggestions will help.

The C grammar is not conflict free. I thought shift-reduce was
a warning in yacc.

-- glen
[It is indeed a warning, but it also warns you that the generated
parser doesn't quite parse the input grammar. -John]

.



Relevant Pages

  • ANSI C grammar without shift-reduce conflict on ELSE
    ... I'm trying to use the ANSI C Grammar from ... "shift - reduce on ELSE" error. ... really be useful if I could get a grammar that's conflict free. ...
    (comp.compilers)
  • Re: somebody dropped a (warning) bomb
    ... The issue is not that the warning isn't "technically correct". ... I can say totally idiotic things in perfectly reasonable English grammar ... So there are lots of reasons to use "unsigned char" arrays for strings. ...
    (Linux-Kernel)
  • Re: A Grammar Writing Question
    ... the language truly requires an exhaustive parser (one that pursues ... effectively proved that in his C++ grammar exploration work. ... strings that the grammar allows. ... I haven't seen any PEG tools that give you that warning. ...
    (comp.compilers)
  • Re: Two footnotes in Chapter 1 SICP
    ... > Abelson and Sussman are warning you that a "body" that ... > interleaves definitions and expressions (which is not truly a body, ... > the grammar) will be allowed by many real Scheme implementations, ...
    (comp.lang.scheme)
  • Re: ANSI C grammar without shift-reduce conflict on ELSE
    ... really be useful if I could get a grammar that's conflict free. ... defaults to shift, as per the usual semantics of C,Pascal,Modula2 etc. ... the else-clause to the innermost if-statement, ... making these two inputs equivalent: ...
    (comp.compilers)