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

35
LINES

< > BotCompany Repo | #1002962 // Test SimpleInterpreter

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

Libraryless. Click here for Pure Java version (1372L/9K/30K).

!752

!include #1002960 // SimpleInterpreter

static Lisp splitOps(Lisp x) {
  if (!x.is("[]"))
    ret x;
  new L<S> op;
  new Lisp l;
  for (int i = 0; i < x.size(); i++) {
    Lisp c = x.get(i);
    if (c.is("[]", "()") || isQuoted(c.head) || isInteger(c.head)) {
      l.add(/*nlUnbracket*/(c));
      op.add("*");
    } else
      op.add(c.head);
  }
  l.head = join(" ", op);
  ret l;
}

static class MyModule extends Module {
  void go(Lisp x) {
    Lisp y = splitOps(x);
    printStructure("  ", y);
  }
}

p {
  new SimpleInterpreter i;
  i.interpret([=[
    search [this and that]
    print [yay yay]
  ]=], new MyModule);
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002962
Snippet name: Test SimpleInterpreter
Eternal ID of this version: #1002962/1
Text MD5: 5ea7bfe06132b0318734ffd244b3d238
Transpilation MD5: b0a53898f094f98175c7085c900122ad
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-04-10 23:27:30
Source code size: 668 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 553 / 579
Referenced in: [show references]