added function to print AST errors