Download Jar. Uses 4489K of libraries. Click here for Pure Java version (15458L/113K).
!7 static L<S> 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<S> 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<S> 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!))); } } }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, imzmzdywqqli, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1010122 |
Snippet name: | AI's First JavaX Program - AI generates a mini-program from 3 diagrams [OK] |
Eternal ID of this version: | #1010122/58 |
Text MD5: | c8f8ef2a17a4bcca15a3be3eb9fb6498 |
Transpilation MD5: | 37d2a6d2862e1f41c56d215280068807 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-09-04 02:49:01 |
Source code size: | 2529 bytes / 50 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 736 / 1617 |
Version history: | 57 change(s) |
Referenced in: | [show references] |