|shift-reduce conflict, firstname.lastname@example.org (Thinh T. Nguyen) (1998-03-07)|
|Re: shift-reduce conflict, email@example.com (1998-03-13)|
|Re: shift-reduce conflict, dgay@barnowl.CS.Berkeley.EDU (1998-03-15)|
|Re: shift-reduce conflict, firstname.lastname@example.org (1998-03-18)|
|From:||email@example.com (Chris Dollin)|
|Date:||18 Mar 1998 23:05:11 -0500|
|Organization:||Hewlett-Packard Laboratories, Bristol, UK.|
|References:||98-03-070 98-03-120 98-03-140|
firstname.lastname@example.org (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 ?
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.
Return to the
Search the comp.compilers archives again.