1st functional version of AST construction