Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

55
LINES

< > BotCompany Repo | #1001640 // Try to make a source compilable (developing)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (2038L/14K/45K).

1  
!747
2  
3  
m {
4  
  static S snippetID = "#1001579"; // The Riddle
5  
  
6  
  !include #1001497 // parseBoolean
7  
   
8  
  p {
9  
    startBot("Translator Runner Bot", "#1001206");
10  
    
11  
    S src = loadSnippet(snippetID);
12  
    
13  
    // remove the non-symbolic translator invocations
14  
    L<S> lines = toLines(src);
15  
    findTranslators(lines);
16  
    src = fromLines(lines);
17  
    
18  
    L<S> tok = javaTok(src);
19  
    if (hasCodeTokens(tok, "m", "{"))
20  
      src = translate("#628", src); // quickmain
21  
      
22  
    src = translate("#629", src); // standard functions
23  
    
24  
    if (isJavaCompilable(src)) {
25  
      print("Compilable!");
26  
      S transpID = uploadTranspilation(snippetID, src);
27  
      print("Transpilation uploaded as: " + formatSnippetID(transpID));
28  
      //activateTranspilation(snippetID, transpID);
29  
      return;
30  
    }
31  
    
32  
    print("Not compilable.");
33  
  }
34  
  
35  
  static S uploadTranspilation(S snippetID, S src) {
36  
    S title = "Transpilation of " + formatSnippetID(snippetID);
37  
    S id = findSnippet(src, title);
38  
    if (id != null) ret id;
39  
    ret createJavaProgram(src, title);
40  
  }
41  
  
42  
  static void activateTranspilation(S javaxID, S javaID) {
43  
    // TODO
44  
  }
45  
  
46  
  static S translate(S translatorID, S src) {
47  
    S s = sendToLocalBot("Translator Runner Bot", "please run translator * on this text: *", translatorID, src);
48  
    if (isQuoted(s))
49  
      ret unquote(s);
50  
    new Matches m;
51  
    if (find3("stored as *", s, m))
52  
      ret unquote(sendToLocalBot("Translator Runner Bot", "get string *", m.unq(0)));
53  
    throw fail(s);
54  
  }
55  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001640
Snippet name: Try to make a source compilable (developing)
Eternal ID of this version: #1001640/1
Text MD5: 59ddbdbc46092867d00a8ca5ce2d52cd
Transpilation MD5: 2a51eb222dbf0e487e699b4b156370d4
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-31 17:36:26
Source code size: 1564 bytes / 55 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 660 / 788
Referenced in: [show references]