fixed infinite loop in parser.sml, thou the code is still really ugly