logic-engine

module
v0.0.0-...-7d3eea6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2021 License: Apache-2.0

README

logic-engine

Engine for logic programming hosted in Go.

Why

Logic programming is a paradigm well suited to solving combinatory and constrained problems, where we can express a set of relationships and query the solver for a solution that satisfies all constraints simultaneously.

This library was born as a simple unification solver that eventually grew too big and warranted its own project. It is not intended as a standalone language, but rather a hosted one that is able to manipulate Go objects and call Go code. As such, it may be used as an engine instead of shelling out to a full Prolog environment, which necessarily involve some ser-/deserialization.

Features

  • Last-call optimization
  • Dicts
  • Prolog parser
  • DCGs
  • Attributed variables
  • Packages
  • Go integration
  • Delimited continuations
  • Tabling
  • Finite-domain constraint solver

Lots of work ahead :)

About

The execution environment is an interpreter of the Warren Abstract Machine (WAM), that use regular Go pointers instead of managing memory regions directly (heap, stack, choicepoints). This way, we get garbage collection for free and simplify many other concepts -- for example, we keep separate stacks for environments and choicepoints, and environments that are still referenced won't get lost after they return. We also don't need instructions like put_unsafe_value, that promote a value from the register to the stack, since there's no heap region.

To learn more about the WAM, see Aït-Kaci's tutorial.

Directories

Path Synopsis
cmd
Package dsl contains constructors for several types as functions.
Package dsl contains constructors for several types as functions.
Package errors contains utility functions to handle errors.
Package errors contains utility functions to handle errors.
Package logic implements the interface for a logic engine, with terms and solvers.
Package logic implements the interface for a logic engine, with terms and solvers.
Package parser implements a Prolog parser using the engine itself.
Package parser implements a Prolog parser using the engine itself.
Package runes contains some generally useful operations on runes.
Package runes contains some generally useful operations on runes.
Package solver contains methods to execute logic programs and list their solutions.
Package solver contains methods to execute logic programs and list their solutions.
Package wam implements an interpreter for a Warren Abstract Machine.
Package wam implements an interpreter for a Warren Abstract Machine.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL