Re: Help with Yacc++ ?

mab@wdl39.wdl.loral.com (Mark A Biggar)
Wed, 12 Feb 1992 17:27:52 GMT

          From comp.compilers

Related articles
Help with Yacc++ ? nick@manasys.co.nz (1992-02-11)
Re: Help with Yacc++ ? mab@wdl39.wdl.loral.com (1992-02-12)
| List of all articles for this month |

Newsgroups: comp.compilers
From: mab@wdl39.wdl.loral.com (Mark A Biggar)
Keywords: yacc, errors
Organization: Loral Western Development Labs
References: 92-02-048
Date: Wed, 12 Feb 1992 17:27:52 GMT

In article 92-02-048 nick@manasys.co.nz writes:
>I am having trouble with yacc++, an object oriented version of yacc put
>out by a company called Compiler Resources. ...
>I have a grammar
>S: E ;
>E: Id | -E | E-E | E E ;
>Can someone please tell me why yacc [LALR(1)] accepts this but
>yacc++ [LR(1)] doesn't.


Lets split you grammer up into separate productions like so:


S: E; (1)
E: id; (2)
E: -E; (3)
E: E-E; (4)
E: E E; (5)


What yacc++ is saying is that the input id-id-id is ambigious,
When it sees the second - it can't tell if it should reduce using
production (3) or (4).


--
Mark Biggar
mab@dwl1.dwl.loral.com
--


Post a followup to this message

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