Download Jar. Libraryless. Click here for Pure Java version (10807L/74K).
1 | !7 |
2 | |
3 | // We can parse and evaluate ALL THIS: |
4 | |
5 | sS stuffToParse = [[ |
6 | 1 |
7 | 1 - 2 |
8 | 1 - 2 - 3 |
9 | 1 - (2 - 3) |
10 | -5 - 4 |
11 | (4 - 3) - 2 |
12 | 100 / (10 * 2) |
13 | 100 / 10 / 10 |
14 | ]]; |
15 | |
16 | sS concepts = [[ |
17 | // ...just by giving a few parsing concepts (w/increasing binding power): |
18 | |
19 | ["jcnbmtmfzktxhzyf", "X + Y"], |
20 | ["jxcubqjtqykhfvyo", "X - Y", "as in minus"], |
21 | ["erdirznfvsrbtfns", "X / Y", "division"], |
22 | ["bwqhmnorjpyomdbv", "X * Y", "multiplication"], |
23 | |
24 | // ...and a bit of meta-level stuff: |
25 | ["mcoswmplpqlieruo", "(X)"], |
26 | ["olphazqzxxnvtjcx", "X evaluates through standard function Y."], |
27 | ["wwaprwlmqzqeaikp", "A leaf satisfying standard function X evaluates through standard function Y."], |
28 | ["hkihrqgdlkdayxzn", "X is just bracketing."], |
29 | ]]; |
30 | |
31 | // ...and finally linking everything together by relating concepts |
32 | // to JavaX standard functions. |
33 | |
34 | sS statements = [[ |
35 | olphazqzxxnvtjcx jcnbmtmfzktxhzyf "plus" |
36 | olphazqzxxnvtjcx jxcubqjtqykhfvyo "minus" |
37 | olphazqzxxnvtjcx bwqhmnorjpyomdbv "multiply" |
38 | olphazqzxxnvtjcx erdirznfvsrbtfns "divide" |
39 | hkihrqgdlkdayxzn mcoswmplpqlieruo |
40 | wwaprwlmqzqeaikp "isInteger" "bigint" |
41 | ]]; |
42 | |
43 | // The rest is boilerplate. |
44 | |
45 | p-tt { |
46 | centerHigherConsole(); |
47 | testLispEval(concepts, statements, stuffToParse); |
48 | } |
Began life as a copy of #1007981
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wtqryiryparv
No comments. add comment
Snippet ID: | #1007987 |
Snippet name: | Thought Bubble 1 prelude 7: Adding minus and division [WORKS] |
Eternal ID of this version: | #1007987/18 |
Text MD5: | dd82a4f232bff3cebf58e3b636a2d69e |
Transpilation MD5: | 1b59158b8342fa666e808e8b013213e8 |
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-04-18 04:08:29 |
Source code size: | 1276 bytes / 48 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 669 / 1827 |
Version history: | 17 change(s) |
Referenced in: | [show references] |