[antlr-interest] and, finally, ternary operator works
Terence Parr
parrt at cs.usfca.edu
Sat Feb 26 08:48:47 PST 2011
On Feb 25, 2011, at 7:14 PM, Sam Harwell wrote:
> Ternary for C++ is even stranger, though I'm not sure it's necessary to
> support it at this point.
C/C++ do it differently?
>
> x ? a : b = c
>
> should parse as this in C++:
>
> (? x a (= b c))
ack.
> But as this is C (which is found to be invalid at a later time since the
> ternary operator cannot return an lvalue in C):
>
> (= (? x a b) c)
>
> However, in both C and C++ the following:
>
> x = c ? a : b
>
> Should parse as:
>
> (= x (? c a b))
coorect.
> I've been watching for those check-ins, and I see one now! :)
>
you'll be disappointed with size reduction. I only got 50% or so. speed test coming.
Ter
More information about the antlr-interest
mailing list