Construct AST in a single pass