!7 static L inputDiagrams = tlft([=[ CirclesAndLines(circles=[Circle(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=t26, text="consists of"), Arrow(a=t26, b=t47, 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 { print(\"Hello world!\"); }]]", x=d("0.4899135446685879"), y=d("0.5918762088974855"))], lines=[Arrow(a=t5, b=t26, text="is")]) ]=]); p-subst { // Prepare & Reason Web web = webFromCALStructures(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 = web_nodeWithLastWord(web, "Program"); assertNotNull("Program Node", 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); S code = join("\n\n", parts); // Show centerFrame(setFrameSize(800, 600, 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", setFontSize(20, jTypeWriterTextArea(code))))); infoBox("Generated Program:\n\n" + code); hideConsole(); }