Re: x + (y) + z

2005-03-03 Thread Kelly Leahy
By the way, you might want to have a look at http://www.lysator.liu.se/c/ANSI-C-grammar-y.html I don't know if it's different from what you are working from, and I'm not sure how it does in Bison, but it might be worth a try. Kelly --- Derek M Jones <[EMAIL PROTECTED]> wrote: > All, > > The

Re: x + (y) + z

2005-03-03 Thread Frank Heckenbach
Derek M Jones wrote: > The statement (y)+z can be parsed as casting > +z to the type y, or as adding y to z. A couple of > %dprecs solve this problem (I think the cast is the > common case for - and a binary expression for +). What the "common case" is doesn't really matter since a correct parse

Re: x + (y) + z

2005-03-03 Thread Kelly Leahy
> to > > add-expr: > mul-expr| > mult-expr '+' add-expr | > mult-expr '-' add-expr ; > I don't think that's what you want if you're planning on executing the code you generate from this... This means that 3 - 4 + 4 = -5, rather

x + (y) + z

2005-03-03 Thread Derek M Jones
All, The statement (y)+z can be parsed as casting +z to the type y, or as adding y to z. A couple of %dprecs solve this problem (I think the cast is the common case for - and a binary expression for +). However, things are more complicated for x + (y) + z, whose parse tree can be either