Libraryless. Click here for Pure Java version (1372L/9K/30K).
1 | !752 |
2 | |
3 | !include #1002960 // SimpleInterpreter |
4 | |
5 | static Lisp splitOps(Lisp x) { |
6 | if (!x.is("[]")) |
7 | ret x; |
8 | new L<S> op; |
9 | new Lisp l; |
10 | for (int i = 0; i < x.size(); i++) { |
11 | Lisp c = x.get(i); |
12 | if (c.is("[]", "()") || isQuoted(c.head) || isInteger(c.head)) { |
13 | l.add(/*nlUnbracket*/(c)); |
14 | op.add("*"); |
15 | } else |
16 | op.add(c.head); |
17 | } |
18 | l.head = join(" ", op); |
19 | ret l; |
20 | } |
21 | |
22 | static class MyModule extends Module { |
23 | void go(Lisp x) { |
24 | Lisp y = splitOps(x); |
25 | printStructure(" ", y); |
26 | } |
27 | } |
28 | |
29 | p { |
30 | new SimpleInterpreter i; |
31 | i.interpret([=[ |
32 | search [this and that] |
33 | print [yay yay] |
34 | ]=], new MyModule); |
35 | } |
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: | 617 / 662 |
Referenced in: | [show references] |