!7 abstract sclass Proposal { toString { ret sfu(this); } } static noToString record EnclosedIn(S l, LS contents, S r) extends Proposal {} static noToString record Infix(LS l, S op, LS r) extends Proposal {} svoid parse(LS tok) { // drop first and last if (l(tok) >= 3) emit(new EnclosedIn(first(tok), dropFirstAndLast_noNewList(tok), last(tok))); for (int i = 1; i < l(tok)-1; i++) emit(new Infix(subList(tok, 0, i), tok.get(i), subList(tok, i+1))); } p-exp { LS tok = javaTokC("[(a|b), (c|d), (e|f)]"); parse(tok); }