Giter Club home page Giter Club logo

prologlib's Introduction

prologlib is an ISO Prolog processor written in Python 3. It aims at providing
an open source Prolog implementation that strictly follows the non-free ISO
standard document (ISO/IEC 13211-1), from execution model to builtin predicates
and functors.

Usage:

$ hg clone http://bitbucket.org/gpiancastelli/prologlib/
$ cd prologlib
$ python3.1 toplevel.py

Besides toplevel.py, in the project root you will also find the test.py script,
used to drive the execution of unit/acceptance tests for prologlib. If you run
it without arguments, test.py executes all the tests in the tests subdirectory,
showing results that should include no failures. You will note, however, that
some tests are skipped: typically, they involve some unimplemented feature. You
may also run test.py providing the name of a single test file, to execute only
that set of tests. For example:

$ test.py builtin-predicates
$ [...executing tests in tests/test-builtin-predicates.py...]
$ test.py parser
$ [...executing tests in tests/test-parser.py...]

No real API is provided. If you want to integrate prologlib into Python code,
have a look at how prologlib.ui uses prologlib.core.Engine.

Source code includes some examples of Prolog code, to be found in the
subdirectory examples. Those include classic Prolog benchmarks, stored in their
own subdirectory.

BE WARNED! prologlib is extremely slow. It's unlikely that you will find it to
be suitable for serious (and less serious) work.

prologlib's code is distributed under the BSD license.

If you are interested in prologlib's development, please visit prologlib's site
on Bitbucket and take advantage of the available tools. Any comment or feedback
that does not fit into Bitbucket facilities should be addressed to:

<[email protected]>

prologlib's People

Contributors

gpiancastelli avatar

Watchers

 avatar

prologlib's Issues

Repeated I/O writes do not show their results immediately

For example, the following query:

?- repeat, write('hello '), fail.

does not write "hello hello hello ..." immediately. It has some kind of buffered behavior. I'm quite sure that's not what is required... need to investigate Python I/O better.

Wrong grouping by bagof/3 in a query with copy_term/2

The query:

?- C = (X=Y ; X=Z), copy_term(C, C2), bagof(X, C2, S).

should give S = [_] instead of S = [_,_] as a solution. I'm not sure if the culprit is bagof/3 or copy_term/2, or some strange interaction between the two, tough.

Problems with copying variables in setof/3?

The test for setof/3 to be found in test-builtin-predicates.SetofTest.test_with_member_predicate_7 is skipped, but really highlights some kind of bug, yet to be identified.

Implement some suitable predicates with generators?

Given how it works, sub_atom/5 could be a first candidate for an implementation that exploits an internal generator. This would detour from the ISO specification, which seems to prescribe that all results must be computed before returning the first solution, though, so I've not made my mind up yet on it.

Problem with functional notation of operators having the same symbol but different arity/priority

Parsing expressions that contains terms written in operational notation where the functor is a symbol bound to more than one operator with different arity/priority may result in the formation of a wrong term.

The most clear example involves -/2 and -/1: the simple '-'(7, 35) term get recognized as '-'(','(7, 35)) instead of '-'(7, 35), showing a conflict between '-'/1 (200) and '-'/2 (500).

Refactor core.unify

The function core.unify is really long and hairy. It contains some portions of repeated code, e.g. when the Most General Unifier generated by unification between two list heads (or tails) has to update the MGU generated by the whole function. These portions could be extracted in a single function, to be implemented within core.unify, so as to shorted the already too long unification function and help clarify it a little.

Missing \+ as operator for negation

\+ (as not/1) does not work because of what is probably a parser bug: the operator "scope" is much wider than the single goal, even when using parentheses!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.