Improve toAST and print result of spdiff