Implement AST construction