static L ai_parseTree_getChildren(AI_BottomUpParser1 parser, L productions, Element e) { if (e.children == null) e.children = ai_parseTree_makeChildren(parser, productions, e); ret e.children; } static L ai_parseTree_makeChildren(AI_BottomUpParser1 parser, L productions, final Element e) { if (e instanceof ChooseCategory) ret map(((ChooseCategory) e).categories, func(S cat) { new HaveCategory(((ChooseCategory) e).word, cat) }); if (e instanceof HaveCategory) { HaveCategory h = cast e; L l = ai_buParser1_reconstructedProductions(parser, productions, h.word, h.category); ret map(l, func(ai_Reconstructed r) -> O { r.production.b == null ? new HaveCategory(r.a, r.production.a, r) : new ChoosePart(r) }); } if (e instanceof ChoosePart) { ai_Reconstructed r = ((ChoosePart) e).reconstruction; ret (L) ll(new HaveCategory(r.a, r.production.a), new HaveCategory(r.b, r.production.b)); } null; }