Re: shift-reduce conflict, (Chris Dollin)
18 Mar 1998 23:05:11 -0500

          From comp.compilers

Related articles
shift-reduce conflict, (Thinh T. Nguyen) (1998-03-07)
Re: shift-reduce conflict, (1998-03-13)
Re: shift-reduce conflict, dgay@barnowl.CS.Berkeley.EDU (1998-03-15)
Re: shift-reduce conflict, (1998-03-18)
| List of all articles for this month |

From: (Chris Dollin)
Newsgroups: comp.compilers
Date: 18 Mar 1998 23:05:11 -0500
Organization: Hewlett-Packard Laboratories, Bristol, UK.
References: 98-03-070 98-03-120 98-03-140
Keywords: yacc, parse (Chris Dollin) writes:
> Can you make Bison happy by allowing
> '(' <expression> ')' <expression>
> as legal syntax, and then requiring that the prefix-expression denote
> a type? Off the top of my head, this should be OK, shouldn't make
> error reporting any more confusing, and even allows for future expansion
> of the language in the direction of type-expressions :-)
> Consider (a) - b. Is this a cast of -b, or a-b ?

\kosh Yes.

It depends on the bindings. My fragment above makes your example ambiguous;
mea culpa. For Java of course you have to pick for the second <expression>
whatever Java allows after a cast -- alas, my reference is at home -- and
I presume that this is not ambiguous.

Were I choosing, I'd make that right operand "as tight as possible". Well,
that's not true; were *I* choosing, I'd not give casts that syntax at all;
I can think of more useful ways to overload parentheses.


Post a followup to this message

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