Skip to content

AST design

Freeman Man edited this page Apr 19, 2016 · 7 revisions

Guide to create abstract syntax tree

create a node if the node is changing type, same applies to terminals

e.g.

  • AssignmentExpression(Expression) to ExpressionStatement(Statement)
  • IdentifierReference(Expression) to Identifier to IDENTIFIER, IdentifierReference(Expression) will be the last point we create a node

avoid creating a new node if what it is doing is just type casting

e.g.

  • from NewExpression to MemberExpression

... more?

Clone this wiki locally