Hi James,

I can't answer your "why" questions, but if you would like to explore
what ASTs are build from certain fragments of code, you can build a
debug version of V8's shell (or d8), and there is a flag --print_ast
that will switch on AST printing.

On Thu, Jan 12, 2012 at 07:36, James Ide <[email protected]> wrote:
> I have a few questions about the AST structure and how the set of nodes
> defined in ast.h (bleeding-edge) were chosen that I hope an engineer
> familiar with V8 would be able to answer for me.
>
> What is the relationship between Assignment and Declaration? The source
> hints to me that Assignment actually knows whether it is a declaration or
> not, and "var x = 0" would be considered an Assignment (whose parent would
> likely be an ExpressionStatement). The separation between assignments and
> declarations makes sense when keeping hoisting in mind, but I'm confused
> because I'm used to thinking that declarations are statements (in ast.h they
> derive directly from AstNode).
>
> At a glance, some of the node types appear somewhat redundant. For example,
> CountOperation looks like it could be adequately described by UnaryOperation
> and the same is true for CompareOperation and BinaryOperation. Are these
> extra nodes (CountOperation and CompareOperation) defined solely for the
> compilation stage?
>
> Why is Throw defined as an expression and not a statement?
>
> How is a try-catch-finally statement represented? I'm also curious as to why
> TryCatchStatement and TryFinallyStatement exist, as opposed to having
> TryStatement encompass all cases.
>
> Some insight would be much appreciated.
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to