Download Jar. Libraryless. Click here for Pure Java version (10338L/70K).
1 | !7 |
2 | |
3 | !include #1007960 // englishToConceptLanguage_xyz |
4 | |
5 | sS concepts = [[ |
6 | ["jcnbmtmfzktxhzyf", "X + Y"], |
7 | ["bwqhmnorjpyomdbv", "X * Y", "multiplication"], |
8 | ["mcoswmplpqlieruo", "(X)"], |
9 | ["olphazqzxxnvtjcx", "X evaluates through standard function Y."], |
10 | ["wwaprwlmqzqeaikp", "A leaf satisfying standard function X evaluates through standard function Y."], |
11 | ["hkihrqgdlkdayxzn", "X is just bracketing."], |
12 | ]]; |
13 | |
14 | sS statements = [[ |
15 | olphazqzxxnvtjcx jcnbmtmfzktxhzyf "plus" |
16 | olphazqzxxnvtjcx bwqhmnorjpyomdbv "multiply" |
17 | hkihrqgdlkdayxzn mcoswmplpqlieruo |
18 | wwaprwlmqzqeaikp "isInteger" "bigint" |
19 | ]]; |
20 | |
21 | p { |
22 | useConcepts(concepts); |
23 | useFacts_cl(statements); |
24 | set englishToConceptLanguage_xyz_debug; |
25 | printIndent(eval(parse(print("1")))); |
26 | assertEqualsVerbose(bigint(5), eval(parse(print("(5)")))); |
27 | assertEqualsVerbose(bigint(6), eval(parse(print("2 * (3)")))); |
28 | assertEqualsVerbose(bigint(6), eval(parse(print("1 * (2 + 3)")))); |
29 | assertEqualsVerbose(bigint(9), eval(parse(print("(1 + 2) * 3")))); |
30 | assertEqualsVerbose(bigint(21), eval(parse(print("(1 + 2) * (3 + 4)")))); |
31 | print("OK!!"); |
32 | } |
33 | |
34 | static Lisp parse(S s) { |
35 | ret englishToLispWith(s, ll("mcoswmplpqlieruo", "jcnbmtmfzktxhzyf", "bwqhmnorjpyomdbv")); |
36 | } |
37 | |
38 | static O eval(Lisp l) { ret generalLispEval(l); } |
Began life as a copy of #1007956
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: | #1007962 |
Snippet name: | Thought Bubble 1 prelude 4: Parsing test with brackets |
Eternal ID of this version: | #1007962/6 |
Text MD5: | 97cd44c740790bdf3cc27a99ffc811bf |
Transpilation MD5: | 67720ef709ec776825c838527a88162d |
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-17 21:46:48 |
Source code size: | 1307 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 709 / 1498 |
Version history: | 5 change(s) |
Referenced in: | [show references] |