Ok thank you :)

On Sat, Oct 1, 2011 at 4:31 PM, Lasse Reichstein
<[email protected]> wrote:
> There is nothing in the complexity of '+' that mandates your Abstract Syntax
> Tree layout. It's still pure syntax at this point.
> However, any use of the parsed syntax must behave as if the (+ a b c) syntax
> tree is equivalent to (+ (+ a b) c), so it won't buy you much, and probably
> just makes using the parsed syntax more complex.
> If repeated use of the same operator happens a lot, and you can easily
> handle the pairing later, by all means do make a single vairable-sized node.
> E.g., in the RegExp grammar, adjacent literal characters are really a
> sequence of Alternatives of Terms (of Atoms), but it happens so often that
> you probably want to parse /abel.*/ as containing a single text-node with
> the text "abel".
> Just don't optimize the abstract syntax without considering how it's going
> to be used.
> /L
>
> On Sat, Oct 1, 2011 at 12:28 PM, Xavier MONTILLET <[email protected]>
> wrote:
>>
>> Right. I totally forgot that...
>> So I have to keep only two operands per operator.
>> Thank you for answering :)
>>
>> On Sat, Oct 1, 2011 at 12:48 AM, Poetro <[email protected]> wrote:
>> > The + operator is not just for numbers and can have sideeffects, if
>> > the operands have different types or the operands are not numbers or
>> > strings (and even in that case). This makes the + operator tricky.
>> >
>> >>>> "boo" + 1 + 2
>> > "boo12"
>> >>>> 1 + 2 + "boo"
>> > "3boo"
>> >
>> >>>> var a = {toString: function () { return 1; }, valueOf: function () {
>> >>>> return 2; }}, b = 0; a + b
>> > 2
>> >
>> > --
>> > Poetro
>> >
>> > --
>> > To view archived discussions from the original JSMentors Mailman list:
>> > http://www.mail-archive.com/[email protected]/
>> >
>> > To search via a non-Google archive, visit here:
>> > http://www.mail-archive.com/[email protected]/
>> >
>> > To unsubscribe from this group, send email to
>> > [email protected]
>> >
>>
>> --
>> To view archived discussions from the original JSMentors Mailman list:
>> http://www.mail-archive.com/[email protected]/
>>
>> To search via a non-Google archive, visit here:
>> http://www.mail-archive.com/[email protected]/
>>
>> To unsubscribe from this group, send email to
>> [email protected]
>
> --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/[email protected]/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe from this group, send email to
> [email protected]
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to