Git Product home page Git Product logo

pil's Introduction

This is a small implementation of prolog.
The License is GPL2 with Ocaml linking exception (same as the Ocaml source code).

At this point the language has only a few primitives implemented:

true/0, false/0, listing/0, halt/0, ground/1, var/1, asserta/1, assertz/1, consult/1, =/2,
is/2, arithmetic and comparison operators for integers, and the mandatory conjunction and
disjunction operators.


I started writing this project after I realized that it might be possible to implement
prolog without a goal stack (which is the usually the choosen design) using continuation 
passing style programming. I wrote several parsers using this style in the past, and
also an Earley parser (which you'll find on github as well). You may see that the later
basically follows a principle similar to prolog, but with breadth first search rather
than depth first.

So there are two branches provided, "master" which hosts the CPS based implementation, and
"stack-based", whose name is quite explicit. Actually, it turned out more involved to
write the stack based version, once I had the CPS one basically working (which feels much
more natural, and whose code looks quite less convoluted).

There are probably still bugs lingering in the code - if you find any just let me know -
and it hasn't been written with speed in mind, so don't try comparing it with any other 
implementation yet (well, if you can manage to find code which only relies on the few 
primitives supported here).


pil's People

Contributors

youjinbou avatar

Watchers

 avatar James Cloos avatar

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.