move main out of parser.y