generate abstract syntax tree for function