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

43
LINES

< > BotCompany Repo | #1002733 // SNL Logic Engine 2

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

Libraryless. Click here for Pure Java version (4064L/26K/84K).

1  
!759
2  
3  
static S codeSnippetID = "#1002732";
4  
5  
static Lisp code;
6  
7  
p {
8  
  code = snlToTree(loadSnippet(codeSnippetID));
9  
  print(getProgramID() + ": parse result = " + code);
10  
}
11  
12  
static boolean yo(Lisp snl, Map m) {
13  
  new HashMap<S, Lisp> m2;
14  
15  
  // we don't know jack!
16  
  
17  
  if (snlMatch("i < don't < know < X", snl, m2))
18  
    ret true;
19  
20  
  ret false;
21  
}
22  
23  
!include #1002743 // LThread
24  
25  
answer {
26  
  if (!attn()) ret null;
27  
  
28  
  // convert to SNL first
29  
  s = or((S) callOpt/*Safe*/(getBot ("#1002700"), "naiveSNL", s), s);
30  
  Lisp in = snlToTree(s);
31  
  
32  
  LThread thread = new LThread(code);
33  
  thread.statements.add(snlToTree("user < says < [" + snlFromTree(in) + "]"));
34  
  
35  
  print("Statements: " + structure(thread.statements));
36  
 
37  
  if (!thread.run())
38  
    ret null;
39  
      
40  
  Lisp out = first(thread.output);
41  
  if (out != null)
42  
    ret "[SNL: " + snlFromTree(in) + "]\n" + snlToText(out);
43  
}

Author comment

Began life as a copy of #1002723

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: #1002733
Snippet name: SNL Logic Engine 2
Eternal ID of this version: #1002733/1
Text MD5: f23b24b7076af72013cdf707bd17b4a4
Transpilation MD5: 067c27c18c4188095b1b97e7eac82957
Author: stefan
Category: eleu / nl
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-02-19 03:24:46
Source code size: 915 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 649 / 877
Referenced in: [show references]