Giter VIP home page Giter VIP logo

hak_wambook's Introduction

WAM Book Prolog

This is an implementation of the family of logic compilers described in "Warren's Abstract Machine: A Tutorial Reconstruction" by Hassan Aït-Kaci.

A family of logic compilers is described in this book, starting from L0 which introduces unification, through L1, L2 and L3, which build up more of a Prolog implementation, leading the WAM, which is a more complete Prolog implementation and optimizes the simpler designs of the earlier languages.

A copy of the WAM book, with errata, can be found here:

https://github.com/a-yiorgos/wambook    

Getting Started

Ensure you have Apache Maven 3.2.2 or later installed.

Build with:

> mvn clean install

Run the WAM implementation with:

> cd target
> chmod +x wam
> ./wam

Audience

This work may be of interest to students of compiler design. The code is well documented, and tries to faithfully implement the design described in the book.

This work was originally produced in order for me to learn how such a compiler works, as well as to provide a basis for experimenting with variations on logic programming languages.

In addition to Prolog, you can find examples of parsers, and elements of a modular compiler design that are fairly "text book" in their nature. The symbol table design was heavily influenced by one described in "Engineering A Compiler", by Keith Cooper and Linda Torczon, and could be re-used in other compiler projects.

State of the work

The languages L0 through L3 are complete as per the book.

The WAM machine is missing the indexing scheme. This may get completed at a later date, especially if someone were to contribute it.

The languages L0 through L2 also have native byte code machines implemented in C. Given the state-of-the-art in Java compilations and virtual machines, these are unlikely to offer a performance advantage over the machines implemented in Java.

The language L2 has a JIT compilation machine implemented on top of LLVM. This is not 100% complete, but provides a decent introduction to compiling down to native code.

Other Sources

Some parts of the source are outside of this git repository, the Prolog parser in particular, as these are also used in other projects. Take a look at this repository if you want a copy of all of the sources:

https://github.com/rupertlssmith/lojix

This is currently built against version 0.8.11 of lojix, to get the sources for that version checkout its tag:

> git clone https://github.com/rupertlssmith/lojix.git
> cd lojix
> git checkout v0.8.11

hak_wambook's People

Watchers

 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.