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

22
LINES

< > BotCompany Repo | #1002830 // Test class Prolog 4 (more complex rule parsing)

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

Libraryless. Click here for Pure Java version (4565L/30K/95K).

1  
!752
2  
3  
static S code = [=[
4  
  
5  
  [
6  
    if   [X < is < a < Y]
7  
    and  [a < Y < has < a < Z]
8  
    then [X < has < a < Z]
9  
  ]
10  
  
11  
  [ mark < is < a < guy ]
12  
  [ a < guy < has < a < gun ]
13  
  
14  
]=];
15  
16  
p {
17  
  new Prolog p;
18  
  p.upperCaseVariables = true;
19  
  p.showStuff = true;
20  
  p.addClauses(snlToTree(code));
21  
  printStructure(p.solve(snlToTree("mark < has < a < X"))); // prints X = gun!
22  
}

Author comment

Began life as a copy of #1002829

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: #1002830
Snippet name: Test class Prolog 4 (more complex rule parsing)
Eternal ID of this version: #1002830/1
Text MD5: 459c373deb4cfc4f2003160e7ba12114
Transpilation MD5: af019328626573656ea9e6211ebebeb3
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-03-03 01:28:29
Source code size: 396 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 535 / 558
Referenced in: [show references]