[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: x + (y) + z
From: |
Derek M Jones |
Subject: |
Re: x + (y) + z |
Date: |
Sat, 05 Mar 2005 14:43:22 +0000 |
Hans,
>At 20:41 +0000 2005/03/03, 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 +).
>
>The normal way to resolve this would be to let the lexer check the lookup
>table to see what y is: a type or a number identifier, and then return that
>type. WHy does this not work for you.
Because I don't have a symbol table to look things up in.
Perhaps I should have pointed this out (it also answers
Frank Heckenbach's question). When parsing the visible
source (ie not doing any preprocessing; well apart from
ignoring the directives) a statement/declaration at a time
the content of a symbol table are likely to be very incomplete.
>The commands %left and %right handles left and right associativity.
Good alternative suggestion. But this still requires tree rewriting
after the expression has been parsed. My %gooa option proposal
avoids this grammar violence.
derek
--
Derek M Jones tel: +44 (0) 1252 520 667
Knowledge Software Ltd mailto:address@hidden
Applications Standards Conformance Testing http://www.knosof.co.uk
- Re: x + (y) + z, Hans Aberg, 2005/03/04
- Re: x + (y) + z,
Derek M Jones <=
- Re: x + (y) + z, Hans Aberg, 2005/03/06
- Re: x + (y) + z, Hans Aberg, 2005/03/06
- Re: x + (y) + z, Derek M Jones, 2005/03/06
- Re: x + (y) + z, Frank Heckenbach, 2005/03/07
- Re: x + (y) + z, Derek M Jones, 2005/03/07
- Re: x + (y) + z, Frank Heckenbach, 2005/03/07
- Re: x + (y) + z, Derek M Jones, 2005/03/07
- Re: x + (y) + z, Frank Heckenbach, 2005/03/07
- Re: x + (y) + z, Derek M Jones, 2005/03/08