Transforming parse tree to AST
Once we can parse a program's syntax, we convert it into a semantic representation called an "abstract syntax tree" (AST).
Parrot Compiler Toolkit provides a set of generic AST nodes:
- PAST::Node - base class
- PAST::Op - basic operations
- PAST::Val - values (typically constants)
- PAST::Var - variables
- PAST::Stmts - collection of statements
- PAST::Block - lexical scopes and closures
Each node may have attributes and other PAST nodes as children.