Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

AST design

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

Guide to create abstract syntax tree

create terminals at the latest node possible when it changes type

  • e.g. IdentifierReference(Expression) to Identifier to IDENTIFIER, IdentifierReference(Expression) will be the last point we create a node

create a node if the node is changing type

  • e.g. AssignmentExpression(Expression) to ExpressionStatement(Statement)

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