2010/2/26 Nick Santos <nicksan...@google.com>:
> On Fri, Feb 26, 2010 at 4:33 PM, Mike Samuel <mikesam...@gmail.com> wrote:
>>
>> This format can store meta-information (e.g., source location info)
>> that is not part of the parse tree in a way that can round trip well
>> and that would get lost if javascript source were used as the
>> interchange format.  It can also work well with systems that produce
>> invalid parse trees as intermediate forms, e.g. with hanging elses and
>> numeric literals that might render as references to masked variables
>> prior to alpha-renaming.
>
> When you say that "systems that produce invalid parse trees", you say
> that as if it's an advantage. It's seems to me that this makes things
> much, much harder. Each of our 3 parsers would need to know the
> possible invalid states of the other 2.

Some trees are logically valid, but cannot be produced by any parser.
For example, in caja,
  if (foo) { if (bar) boo; } else baz;
parses to a structure like
  (Conditional
    (Reference (Identifier : foo))
    (Block
      (Conditional
        (Reference (Identifier : bar))
        (ExpressionStmt
          (Reference (Identifier : bar)))))
    (ExpressionStmt
      (Reference (Identifier : baz))))
Note that without the curly brackets there would be no (Block) node.

There are local preconditions in parse tree constructors and mutators
that prevent logically impossible structures, but these local
preconditions can't check nonlocal constraints like hanging-elses.
A pass that removed all Blocks with single children might produce the
logically valid, but unparseable
  (Conditional
    (Reference (Identifier : foo))
    (Conditional
      (Reference (Identifier : bar))
      (ExpressionStmt
        (Reference (Identifier : bar))))
    (ExpressionStmt
      (Reference (Identifier : baz))))


> Or maybe your definition of "invalid" is different than mine here.

"Invalid" was probably the wrong word to use here.  I meant just "a
syntax tree that cannot be produced by the parser,"  and did not mean
to suggest that it violated logical constraints.

> i'm also curious about the answers to Joey and Robert's questions.
>
> Nick
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to