split main function out of parser.leg into separate file to allow packaging of prog and library