!7 static L inputDiagrams = tlft([=[ CirclesAndLines(circles=[Circle(quickvis="A JavaX Program", text="A JavaX Program", x=d("0.28674351585014407"), y=d("0.20889748549323017")), Circle(text="a translator invocation", x=d("0.6801152737752162"), y=d("0.20889748549323017")), Circle(text="a main program", x=d("0.6801152737752162"), y=d("0.6015473887814313"))], lines=[Arrow(a=t5, b=t30, text="consists of"), Arrow(a=t30, b=t51, text="and")]) CirclesAndLines(circles=[Circle(text="a typical translator invocation", x=d("0.3746397694524496"), y=d("0.4700193423597679")), Circle(text="[[!7]]", x=d("0.7896253602305475"), y=d("0.4700193423597679"))], lines=[Arrow(a=t5, b=t26, text="is")]) CirclesAndLines(circles=[Circle(text="an example main program", x=d("0.49135446685878964"), y=d("0.195357833655706")), Circle(text="[[p { infoBox(\"Hello world!\"); }]]", x=d("0.4899135446685879"), y=d("0.5918762088974855"))], lines=[Arrow(a=t5, b=t26, text="is")]) ]=]); static new Var code; p { // Prepare & Reason Web web = webFromCALStructures_vis(inputDiagrams); web_dropSecondWord(web, "typical"); web_dropSecondWord(web, "example"); web_replaceFirstWord(web, "an", "a"); web_mergeNodes(web); web_collapseBackwardsWithName(web, "is"); // Make Program WebNode program = assertNotNull("Program Node", web_nodeWithLastWord(web, "Program")); WebNode n = web_findForwardRelated(program, "consists of"); new L parts; if (n != null) do ping { parts.add(unquote(n.text())); } while ((n = web_findForwardRelated(n, "and")) != null); code.set(join("\n\n", parts)); // Show magellan(); cal_lineLength(45); CirclesAndLines.defaultBackgroundImageID = #1009675; //#1009676 frameIcon(#1010138, centerFrame(650, 500, showTabbedWebs(0, "User Input 1", webFromCALStructure(get(inputDiagrams, 0)), "User Input 2", webFromCALStructure(get(inputDiagrams, 1)), "User Input 3", webFromCALStructure(get(inputDiagrams, 2)), "Computed Web", web, "Generated Program", centerAndNorth( withMargin(20, withTitle(setFontSize(20, jlabel("The Code")), setFontSize(20, bindTextAreaToVar(code, jtypewritertextarea())))), withMargin(jcenteredline(setFontSize(20, jbutton("Compile & Run!", f runProgram)))))))); thread { loading " Precompiling... " { veryQuickJava(dropTranslators(code!)); }} // precompile hideConsole(); } svoid runProgram { thread { loading { callMain(veryQuickJava(dropTranslators(code!))); } } }