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

48
LINES

< > BotCompany Repo | #1007981 // Thought Bubble 1 prelude 6: Hygienic recurse

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

Download Jar. Libraryless. Click here for Pure Java version (10624L/73K).

!7

sS stuffToParse = [[
  1
  1 + 2
  (5)
  2 * (3)
  1 * (2 + 3)
  (1 + 2) * 3
  (1 + 2) * (3 + 4)
  1 + 2 * 3
  1 * 2 + 3
]];

sS concepts = [[
  ["jcnbmtmfzktxhzyf", "X + Y"],
  ["bwqhmnorjpyomdbv", "X * Y", "multiplication"],
  ["mcoswmplpqlieruo", "(X)"],
  ["olphazqzxxnvtjcx", "X evaluates through standard function Y."],
  ["wwaprwlmqzqeaikp", "A leaf satisfying standard function X evaluates through standard function Y."],
  ["hkihrqgdlkdayxzn", "X is just bracketing."],
]];

sS statements = [[
  olphazqzxxnvtjcx jcnbmtmfzktxhzyf "plus"
  olphazqzxxnvtjcx bwqhmnorjpyomdbv "multiply"
  hkihrqgdlkdayxzn mcoswmplpqlieruo
  wwaprwlmqzqeaikp "isInteger" "bigint"
]];

p-tt {
  centerHigherConsole();
  useConceptsAndCLStatements(concepts, statements);
  //set englishToConceptLanguage_xyz_debug;
  for (S line : toLinesFullTrim(stuffToParse))
    testParse(line);
}

svoid testParse(S s) {
  Lisp l = hygienicParse1(s);
  S result = null;
  if (l != null) result = str(eval(l));
  printIndent(s + " = " + or(result, "?"));
  if (l != null) printIndent(l);
  print();
}

static O eval(Lisp l) { ret generalLispEval(l); }

Author comment

Began life as a copy of #1007978

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: #1007981
Snippet name: Thought Bubble 1 prelude 6: Hygienic recurse
Eternal ID of this version: #1007981/15
Text MD5: 57c05ee98206bdacf33edca3e5a309b5
Transpilation MD5: 9f84e740887550118fd6beea52c35c8f
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 02:23:21
Source code size: 1176 bytes / 48 lines
Pitched / IR pitched: No / No
Views / Downloads: 631 / 1256
Version history: 14 change(s)
Referenced in: #1007987 - Thought Bubble 1 prelude 7: Adding minus and division [WORKS]