static S ai_ruleToJava(S ruleName) { S ruleText = unquote(firstPossibleRule(ai_texts("$X", "is", ruleName))); if (ruleText == null) fail("Rule not found: " + ruleName); S op = joinWithSpace(ai_getOperator(ruleText)); if (neq(op, "if input * then say *")) fail("Unknown rule op: " + op); L<S> l = ai_getOperands(ruleText); ret "static S rule_" + wordsToCamelCase(lower(ruleName)) + "() {\n" + " ai_checkInput_match3(" + quote(deRoundBracket(first(l))) + ");\n" + " ret " + quote(deRoundBracket(second(l))) + ";\n" + "}"; }
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: | #1013445 |
Snippet name: | ai_ruleToJava |
Eternal ID of this version: | #1013445/5 |
Text MD5: | 5e9a00592a960eb510a3772a0b3c77fd |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-01-07 02:31:42 |
Source code size: | 557 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 472 / 507 |
Version history: | 4 change(s) |
Referenced in: | [show references] |