|
List Info
Thread: Operators and their arguments
|
|
| Operators and their arguments |

|
2006-05-22 19:49:42 |
|
>
>
> On 22-May-06, at 10:30 AM, Jon Kleiser wrote:
>
> > A short description of the problem is this:
> >
> > Io to some degree allows us to write arithmetic expressions with
> > operator precedence as in C or FORTRAN, but when an operator is
> > followed by a parenthesis, the operator "forgets about" precedence
> > rules and acts as a normal Io method.
> >
> > This can of course be confusing for a newbie, and as far as I know
> > there isn't much to be found on this behavior in the Io docs. My
> > example is this:
> >
> > 1 + 5 * 4
> > ==> 21 // expected
> >
> > 1 + (2 + 3) * 4
> > ==> 24 // you see?
>
> Out of curiosity, what would be you suggest to fix this problem? No
> precedence? Consider parens grouping rather than the beginning of an
> arg list on operators? or are you ambivalent? And why would you
> suggest this course of action?
>
> > /Jon
>
> --
> Jeremy Tregunna
> jtregunna ...
I have been working on an Io lexer/parser lately, written in Io, that I plan to make available
in a day or two. The tests so far have been very promising. However, just recently I
discovered that my lexer/parser handled operators and following parentheses different
from the standard Io lexer/parser. I got a bit worried at first, but now I'm wondering if this
non-standard behavior may actually be an acceptable solution to the problem above.
When a bunch of critical testers have tried my lexer/parser for some time, we may know if
it's the right way to go or not. (If it's acceptable, then someone would have to implement it
in C.)
/Jon
|
[1]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|