Skip to content

obtaining abstract syntax tree #444

Answered by MikePopoloski
nhasabni asked this question in Q&A
Discussion options

You must be logged in to vote

I think of the SyntaxTree / SyntaxNode as the "parse tree" or equivalently "concrete syntax tree" as you mention. The abstract syntax tree is built out of symbols, expressions, statements, etc by the Compilation object. That "tree" is serializable to JSON via the ASTSerializer class but it's done in a kind of ad-hoc / not very generalizable fashion so if you want something other than JSON you need to walk the tree yourself (the ASTVisitor class can be of help here).

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@nhasabni
Comment options

@nhasabni
Comment options

@MikePopoloski
Comment options

@nhasabni
Comment options

Answer selected by MikePopoloski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants