!7 p-exp { L tok = javaTokPlusBrackets(mL_raw("Logic Example")); L l = splitAtDoubleArrow(tok); if (l(l) != 2) ret; printStruct(new IfThen( parseExpression(first(l)), parseExpression(second(l)))); } static Exp parseExpression(S s) { L tok = javaTokPlusBrackets(s); L l = splitAtTokens(tok, ll("&", "", "&")); if (l(l) == 2) // TODO ret And(parseExpression(first(l)), parseExpression(second(l))); if (l(tok) == 5 && isIdentifier(tok.get(1)) && isRoundBracketed(tok.get(3))) ret Func(tok.get(1), parseExpression(deRoundBracket(tok.get(3)))); ret Sentence(tok); } sclass IfThen { Exp in, out; } sclass Exp {} sclass Func extends Exp { S name; Exp arg; } srecord And(Exp a, Exp b) extends Exp {} sclass Sentence extends Exp { L tok; }