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

35
LINES

< > BotCompany Repo | #1007956 // Thought Bubble 1 prelude 3: Parsing test with precedence [WORKS]

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

Download Jar. Libraryless. Click here for Pure Java version (10328L/70K).

1  
!7
2  
3  
!include #1007960 // englishToConceptLanguage_xyz
4  
5  
sS concepts = [[
6  
  ["jcnbmtmfzktxhzyf", "X + Y"],
7  
  ["bwqhmnorjpyomdbv", "X * Y", "multiplication"],
8  
  ["olphazqzxxnvtjcx", "X evaluates through standard function Y."],
9  
  ["wwaprwlmqzqeaikp", "A leaf satisfying standard function X evaluates through standard function Y."],
10  
]];
11  
12  
sS statements = [[
13  
  olphazqzxxnvtjcx jcnbmtmfzktxhzyf "plus"
14  
  olphazqzxxnvtjcx bwqhmnorjpyomdbv "multiply"
15  
  wwaprwlmqzqeaikp "isInteger" "bigint"
16  
]];
17  
18  
p {
19  
  useConcepts(concepts);
20  
  useFacts_cl(statements);
21  
  //set englishToConceptLanguage_xyz_debug;
22  
  printIndent(eval(parse(print("1"))));
23  
  assertEqualsVerbose(bigint(3), eval(print(parse(print("1 + 2")))));
24  
  printIndent(eval(print(parse(print("1 * 2")))));
25  
  assertEqualsVerbose(bigint(6), eval(parse(print("1 + 2 + 3"))));
26  
  assertEqualsVerbose(bigint(7), eval(parse(print("1 + 2 * 3"))));
27  
  assertEqualsVerbose(bigint(5), eval(parse(print("1 * 2 + 3"))));
28  
  print("OK!!");
29  
}
30  
31  
static Lisp parse(S s) {
32  
  ret englishToLispWith(s, ll("jcnbmtmfzktxhzyf", "bwqhmnorjpyomdbv"));
33  
}
34  
35  
static O eval(Lisp l) { ret generalLispEval(l); }

Author comment

Began life as a copy of #1007950

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007956
Snippet name: Thought Bubble 1 prelude 3: Parsing test with precedence [WORKS]
Eternal ID of this version: #1007956/9
Text MD5: 6d4aaadff897f3174b1d28cbd48717e0
Transpilation MD5: 0e9326b6445952f99f9cc6813f8bdf3e
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:35:26
Source code size: 1152 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 746 / 1651
Version history: 8 change(s)
Referenced in: [show references]