Related articles |
---|
shift-reduce conflict, ttnguyen@eecs.uic.edu (Thinh T. Nguyen) (1998-03-07) |
Re: shift-reduce conflict, kers@hplb.hpl.hp.com (1998-03-13) |
Re: shift-reduce conflict, dgay@barnowl.CS.Berkeley.EDU (1998-03-15) |
Re: shift-reduce conflict, kers@hplb.hpl.hp.com (1998-03-18) |
From: | kers@hplb.hpl.hp.com (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 |
kers@hplb.hpl.hp.com (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.
--
Regards,
Kers.
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.