On May 9, 2009, at 11:57 AM, Brendan Eich wrote:

{op: "||",
 left: {op: "||",
        left: {op: "Id", value: "X"},
        right: {op: "Id", value: "Y"}},
 right: {op: "Id", value: "Z"}}

A definitional interpreter the recursively evaluates nodes can handle this easily enough, although the right-recursive AST alternative, which is equivalent AFAIK, would be better for avoiding recursion. A simple code generator, on the other hand, definitely wants the right-recursive tree:

{op: "||",
 left: {op: "Id", value: "Z"},
 right: {op: "||",
         left: {op: "Id", value: "X"},
         right: {op: "Id", value: "Y"}}}

Of course I got sleepy after cutting and pasting, and didn't edit the values ;-). That should be:

 {op: "||",
  left: {op: "Id", value: "X"},
  right: {op: "||",
          left: {op: "Id", value: "Y"},
          right: {op: "Id", value: "Z"}}}

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to