!7 cmodule BottomUpParser > DynSCP/*WithInput*/ { transient S lastOutput; transient PTElement root; transient ReliableSingleThread rstUpdate; visual withCenteredButtons(super, "Good Parse", rThread { addToMechList_noUniq("Good english parses", "\n" + ai_renderCulledParseTree(root)) }); start { set flag DynModule. // for transpilation rstUpdate = dm_rst(module(), r update); dm_useLocallyCopiedMechLists(); set flag NoFancyMechParsing. ai_parser_activateStandardFunctions(); dm_onTopInputChanged(rstUpdate); doEvery(5000, r { if (dm_isShowingAndOSInForeground()) rstUpdate.trigger(); }); } void update() enter { //if (!isShowing()) { inputChooser.forgetInput(); ret; } S s = dm_topInput(); //inputChooser.input(); root = ai_parseToTreeWithCurlyPhrases(s); S rendered = ai_renderParseTree(root); bool shouldVis = neq(rendered, lastOutput); lastOutput = rendered; if (shouldVis) { JTree tree = jDynamicTree(root, func(final PTElement e) -> L { e == null ? null : e.children }); setComponent(tree); ai_openMainParseInJTree(tree); } } }