##### LM ##### lex literal '-' token file /^('-'|0)(^0)*/ end token word /(^0)+/ token zero /0/ lex token single /[qvh]/ token with_opt /[oi]/ end def item [file zero] | ['-' single* zero] | ['-' with_opt zero? word zero] def args [word zero item*] cons ArgParser: parser [] ArgV: list ArgV = argv for A: str in ArgV send ArgParser [A '\0'] Args: args = ArgParser() print_xml( Args ) print( '\n' ) ##### ARGS ##### -qv -h -o output sdf -i eth0 file ##### EXP ##### ./working/accum3.bin<_repeat_item><_literal_0001>-<_repeat_single>qv<_literal_0001>-<_repeat_single>h<_literal_0001>-o<_opt_zero>outputsdf<_literal_0001>-i<_opt_zero>eth0file