Warning: session_start(): open(/var/lib/php/sessions/sess_uq41unlr9qgspgioa9tckcmq58, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
// We can parse and evaluate ALL THIS:
sS stuffToParse = [[
1
1 - 2
1 - 2 - 3
1 - (2 - 3)
(4 - 3) - 2
100 / (10 * 2)
100 / 10 / 10
]];
sS concepts = [[
// ...just by giving a few parsing concepts:
["jcnbmtmfzktxhzyf", "X + Y"],
["jxcubqjtqykhfvyo", "X - Y", "as in minus"],
["erdirznfvsrbtfns", "X / Y", "division"],
["bwqhmnorjpyomdbv", "X * Y", "multiplication"],
// ...and a bit of meta-level stuff:
["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."],
]];
// ...and finally linking everything together by relating concepts
// to JavaX standard functions.
sS statements = [[
olphazqzxxnvtjcx jcnbmtmfzktxhzyf "plus"
olphazqzxxnvtjcx jxcubqjtqykhfvyo "minus"
olphazqzxxnvtjcx bwqhmnorjpyomdbv "multiply"
olphazqzxxnvtjcx erdirznfvsrbtfns "divide"
hkihrqgdlkdayxzn mcoswmplpqlieruo
wwaprwlmqzqeaikp "javaSingleToken_isInteger" "javaSingleToken_bigint"
]];
// The rest is boilerplate.
p-tt {
centerHigherConsole();
useConceptsAndCLStatements(concepts, statements);
//set englishToConceptLanguage_xyz_debug;
//set hygienicParse1_debug;
for (S line : toLinesFullTrim(stuffToParse))
testParse(line);
}
svoid testParse(S s) {
print(" Parsing: " + s);
Lisp l = hygienicParse1(s);
if (l != null) printIndent("Parsed as: " + l);
S result = null;
pcall {
if (l != null) result = str(eval(l));
}
printIndent(s + " = " + or(result, "?"));
print();
}
static O eval(Lisp l) { ret generalLispEval(l); }