Skip to content

AmziLS/AmziProlog

Repository files navigation

Amzi! Prolog

Source code for the entire Amzi! Prolog system.

Amzi! Prolog is made of the following:

  • Prolog Virtual Machine -- Warren Abstrace Machine (WAM)
  • Logic Server -- a runtime library wrapping around the Prolog-VM, for executing, modifying, and interacting with compiled Prolog programs
  • C API and foreign language bindings -- the Logic Server API (LSAPI) to embed Logic Server into C and other languages, to allow:
    • asserting or retracting clauses (facts or rules) and querying logic bases
    • calling Prolog predicates
    • type specific operations on data (for lists and structures)
    • converting data between the host language and Prolog
    • adding extended predicates, and manipulating their parameters
    • error handling
  • Logic Server Extensions -- .lsx files that provide extended predicates/functions, implemented in other languages
  • Command line tools -- to interpret and debug (alis), compile (acmp), link (alnk) and execute (arun) Prolog programs
    • The Prolog listener alis is an interactive interpreter; the process is aka. REPL.
  • Eclipse IDE plugin -- for comfortable compiling, linking, and debugging

File types:

  • .pro -- Prolog source code (program or module)
  • .plm -- Compiled Prolog module (Prolog/WAM byte code file -- machine independent)
  • .xpl -- Executable Prolog library (a linked collection of .plm files)
  • .lsx -- Logic Server extension (a renamed DLL/SO file)

Common terms:

  • Logic base = knowledge base = Prolog program
  • The Logic Server is a service, with an interface similar to a database server, which allows to query and update the logic base (= Prolog program).
  • Loading of a source code file (.pro), then interpreting it, is called "consulting". This is in contrast to compiled files (.plm/.xpl), which are simply said to be "loaded".
    • Note: neither loading compiled code, nor consulting source code, will automatically execute the main/0 predicate -- use arun if you want that.

See also: Amzi! Prolog Quick Overview and the Detailed Amzi! Prolog Overview

Documentation

User's Guide and Reference
Programmer's Guide
Logic Server User's Guide and Reference

Prolog Articles / Whitepapers
Adventure in Prolog -- A tutorial/guided tour through Prolog
Building Expert Systems in Prolog -- An advanced tutorial

Eclipse

Videos:

Articles:

Repository Contents

The /engine folder contains Amzi! Prolog's core, made of the Prolog-VM and the Logic Server runtime library. The Logic Server's primary API is exposed in C and found under /engine, but has also various foreign language bindings found under /langbindings.

The Prolog compiler, listener, and runner are found under /run. acmp, arun, and alis are the exact same executable, their actual purpose is identified by their filename only:

  • for arun, the engine/Logic Server simply executes the passed .xpl file
  • for alis it loads alis.xpl (source under /listen)
  • for acmp it loads acmp.xpl (found under /compile and the source under https://github.com/AmziLS/AmziPrologCompiler)

/linkrun contains the source for the Prolog linker. /libs contains Prolog libraries that will be compiled to .plm files.

A core extension to Prolog -- which provides OS related functions for handling files, directories, environment variables, and displaying message boxes -- is available under /extensions/osutils. Non-core extensions exist for ODBC, MySQL, Tcl/Tk, and sockets, which can be found in the /extensions folder.

Examples for all core Prolog uses, language bindings, and Prolog extensions are available under /samples.

Finally, apart from a simple Windows IDE (under /winIDE), there is also an Eclipse plugin that provides a more complete experience, found under /eclipse_plugin.

Building and Debugging

For building the whole system, see the /make subdirectory.

It is also possible to load the .sln files in Visual Studio for debugging.

  1. Make sure to adapt bin/amzi_vars_win32.bat and bin/amzi_vars_win64.bat to match the installation paths of the installed dependencies (as mentioned in the building instructions).
  2. Start Visual Studio from either Amzi Prolog 32 Bit Environment (Source).lnk or Amzi Prolog 64 Bit Environment (Source).lnk command line environments, to ensure all the necessary paths are set.
    • Enter devenv to start Visual Studio.

Releases

Releases are available as usual on GitHub, on the right side bar. They contain the built runtime library, and command line tools, but also samples, language bindings, Logic Server extensions, and a ready to use Eclipse plugin. It's the easiest way to get started.

License

Copyright (c) Amzi! inc. 2016, 2021
Licensed under the MIT Open Source License.

About

Amzi! Prolog: complete system to interpret, build, run and debug Prolog programs, but also embed and query them similar to databases.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •