luciangreen / Simple-List-Prolog-to-List-Prolog

Converts Simple List Prolog code to List Prolog code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple-List-Prolog-to-List-Prolog

Converts Simple List Prolog algorithms to List Prolog algorithms

Prerequisites

  • Please download and install SWI-Prolog for your machine at https://www.swi-prolog.org/build/.

1. Install manually

Download this repository.

2. Or Install from List Prolog Package Manager (LPPM)

mkdir GitHub
cd GitHub/
git clone https://github.com/luciangreen/List-Prolog-Package-Manager.git
cd List-Prolog-Package-Manager
swipl
['lppm'].
lppm_install("luciangreen","Simple-List-Prolog-to-List-Prolog").
halt

Running

  • In Shell: cd Simple-List-Prolog-to-List-Prolog swipl ['slp2lp.pl'].

  • Convert Simple List Prolog code to List Prolog code by running:

?- slp2lp([[f1,[a,b,c,d,e],(:-),[[+,[a,b,f]],[+,[c,f,g]],[+,[d,g,h]],[=,[h,e]]]]],Algorithm2),writeln(Algorithm2).
Algorithm2=[[[n,f1],[[v,a],[v,b],[v,c],[v,d],[v,e]],":-",[[[n,+],[[v,a],[v,b],[v,f]]],[[n,+],[[v,c],[v,f],[v,g]]],[[n,+],[[v,d],[v,g],[v,h]]],[[n,=],[[v,h],[v,e]]]]]]

About

Converts Simple List Prolog code to List Prolog code.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Prolog 100.0%