1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
lex start { ignore /space+/ literal '*', '(', ')' token id /[a-zA-Z_]+/ } def item [id] | ['(' item* ')'] def start [item*] Input: start = parse start( stdin ) cons Output: accum<start> [] for Id: id in Input { send Output "( [^Id] ) } S: start = Output() print( S '\n' )