add script for writing antlr4 tree to file