semi-functional function extractor from ast.