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 [item*] ArgParser: parser = new parser() A: list_el = argv->head_el while ( A ) { send ArgParser [A->value '\0'] A = A->next } Args: args = ArgParser->finish() print( xml(Args) ) print( '\n' ) ##### ARGS ##### -qv -h -o output sdf -i eth0 file ##### EXP ##### <_repeat_item><_literal_0001>-<_repeat_single>qv<_literal_0001>-<_repeat_single>h<_literal_0001>-o<_opt_zero>outputsdf<_literal_0001>-i<_opt_zero>eth0file