Functional AST generation