Warning: session_start(): open(/var/lib/php/sessions/sess_83k7juuqdnloubvs7o3422muha, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
abstract sclass Proposal {
int localScore() { ret 0; }
toString { ret "[" + localScore() + "] " + sfu(this); }
Proposal parent;
selfType parent(Proposal parent) { this.parent = parent; this; }
}
static noToString record EnclosedIn(S l, LS contents, S r) extends Proposal {
int localScore() { ret boolToInt(isBracketPair(l, r)); }
}
static noToString record Infix(LS l, S op, LS r) extends Proposal {
}
svoid parse(LS tok, Proposal parent) {
// drop first and last
if (l(tok) >= 3)
emit(new EnclosedIn(first(tok), dropFirstAndLast_noNewList(tok), last(tok)).parent(parent));
for (int i = 1; i < l(tok)-1; i++)
emit(new Infix(subList(tok, 0, i), tok.get(i), subList(tok, i+1)).parent(parent));
}
p-exp {
LS tok = javaTokC("[(a|b), (c|d), (e|f)]");
parse(tok, null);
}