https://github.com/fwcd/kpci
Lightweight, interactive Prolog interpreter written in Haskell
https://github.com/fwcd/kpci
interpreter prolog repl sld
Last synced: 5 months ago
JSON representation
Lightweight, interactive Prolog interpreter written in Haskell
- Host: GitHub
- URL: https://github.com/fwcd/kpci
- Owner: fwcd
- License: bsd-3-clause
- Created: 2020-02-17T09:04:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-29T15:46:37.000Z (almost 6 years ago)
- Last Synced: 2026-02-15T16:39:58.143Z (5 months ago)
- Topics: interpreter, prolog, repl, sld
- Language: Haskell
- Homepage:
- Size: 338 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# The Kiel Prolog Compiler Interactive
[](https://github.com/fwcd/kpci/actions)
An interactive Prolog interpreter written by Hendrik and Fredrik.
The interpreter uses unification, SLD resolution and various tree search algorithm (DFS, BFS, IDDFS) to find a set of solutions given a query. A more detailed description can be found in [OVERVIEW.md](OVERVIEW.md).
More advanced features that are supported:
* Higher-order predicates (`call`)
* Negation-as-failure (`\+`)
* Arithmetic (`is`)
Not implemented yet:
* Encapsulation of nondeterminism (`findall`)
## Project Structure
```
app: Executable sources (Haskell)
examples: Prolog sources
rules: Prolog (rule) files
tests: Lists of Prolog queries to be asserted
resources: Additional resources
src: Library sources (Haskell)
tests: Test suite sources (Haskell)
```
## Running
To run, you will need `cabal-install`. Once installed, just run `cabal v2-run` to open the Prolog REPL.
## Usage
You can try a simple example by loading a Prolog file from the `examples/rules` folder and entering a query:
```
:l examples/rules/last.pl
last([1, 2, 3], X).
```
## Testing
To execute the test suite, run `cabal v2-test`.