# Token names. lex token number /[0-9]+/ token id /[a-z]+/ token string /'"' [^"]* '"'/ ignore ws / [ \t\n]+ / end def prefix [id] def choice1 [number number] | [number] def choice2 [string id] | [number number] | [id number] | [number] def start [prefix choice1 choice2 string id id] { print( xml( match lhs "id 77 88 \"hello\" dude dude\n" ) ) } parse start[stdin] print( '\n' ) ##### IN ##### id 77 88 "hello" dude dude ##### EXP ##### id7788"hello"dudedude