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

30
LINES

< > BotCompany Repo | #1001054 // Simple function call interpreter (developing)

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

Libraryless. Click here for Pure Java version (396L/4K/10K).

1  
!747
2  
3  
m {
4  
  static S cmd = "show(\"hello\");";
5  
  
6  
  p {
7  
    go(); // to reuse variable name "args"
8  
  }
9  
  
10  
  static void go() {
11  
    L<S> tok = javaTok(cmd);
12  
    S functionName = tok.get(1);
13  
    new L<S> args;
14  
    if (tok.size() > 7) {
15  
      assertEquals("(", tok.get(3));
16  
      int i = 5;
17  
      while (i < tok.size() && !eq(tok.get(i), ")")) {
18  
        args.add(unquote(tok.get(i)));
19  
        i += 2;
20  
        if (tok.get(i).equals(","))
21  
          i += 2;
22  
      }
23  
    }
24  
    call(main.class, functionName, args.toArray(new String[args.size()]));
25  
  }
26  
  
27  
  static void show(S s) {
28  
    print(s);
29  
  }
30  
}

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: #1001054
Snippet name: Simple function call interpreter (developing)
Eternal ID of this version: #1001054/1
Text MD5: 24b411f23b25e6be70750fd30de6759e
Transpilation MD5: 0a76f98323f0291d8803e913a0c0ae20
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-09-18 01:53:19
Source code size: 622 bytes / 30 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 662 / 671
Referenced in: [show references]