prolog alternatives and similar packages
Based on the "Embeddable Scripting Languages" category.
Alternatively, view prolog alternatives based on common mentions on social networks and blogs.
-
expr
DISCONTINUED. Expression language and expression evaluation for Go [Moved to: https://github.com/expr-lang/expr] -
RuleGo
βοΈRuleGo is a lightweight, high-performance, embedded, next-generation component orchestration rule engine framework for Go. -
Gentee script programming language
Gentee - script programming language for automation. It uses VM and compiler written in Go (Golang).
CodeRabbit: AI Code Reviews for Developers

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of prolog or a related project?
Popular Comparisons
README
[prolog - the only reasonable scripting engine for Go](prolog.gif)
What is this?
ichiban/prolog
is an embeddable scripting language for Go.
Unlike any other scripting engines, ichiban/prolog
implements logic programming language Prolog.
- Easy to reason about: based on first-order logic
- Easy to adopt:
database/sql
-like Go API - Intelligent: full-featured Prolog implementation
- Highly customizable: sandboxing, custom predicates
ichiban/prolog
vs otto vs go-lua
prolog | otto | go-lua | |
---|---|---|---|
Language | ISO Prolog | ECMA Script | Lua |
Paradigm | π Logic | Object-oriented | Object-oriented |
Go API | π» database/sql -like |
original | original |
Declarative | β | β | β |
Sandboxing | β | β | β |
Getting started
Install latest version
go get -u github.com/ichiban/prolog@latest
Usage
Instantiate an interpreter
p := prolog.New(nil, nil)
Or, if you want to expose standard input/output to your interpreter:
p := prolog.New(os.Stdin, os.Stdout)
Or, if you want a secure interpreter without any builtin predicates:
// See examples/sandboxing/main.go for details.
p := new(prolog.Interpreter)
Load a Prolog program
if err := p.Exec(`
:- [abc]. % Load file 'abc' or 'abc.pl'.
:- ['/path/to/abc']. % Load file '/path/to/abc' or '/path/to/abc.pl'.
% You need to quote to contain / in the path.
:- [library(dcg)]. % Load library 'library(dcg)'.
% See examples/dcg/main.go for a complete example.
human(socrates). % This is a fact.
mortal(X) :- human(X). % This is a rule.
`); err != nil {
panic(err)
}
Run the Prolog program
// Prolog program invocation takes a form of query.
sols, err := p.Query(`mortal(Who).`)
if err != nil {
panic(err)
}
defer sols.Close()
// Iterates over solutions.
for sols.Next() {
// Prepare a struct with fields which name corresponds with a variable in the query.
var s struct {
Who string
}
if err := sols.Scan(&s); err != nil {
panic(err)
}
fmt.Printf("Who = %s\n", s.Who)
// ==> Who = socrates
}
Built-in Predicates
License
Distributed under the MIT license. See LICENSE
for more information.
Contributing
See ARCHITECTURE.md
for architecture details.
- Fork it (https://github.com/ichiban/prolog/fork)
- Create your feature branch (git checkout -b feature/fooBar)
- Commit your changes (git commit -am 'Add some fooBar')
- Push to the branch (git push origin feature/fooBar)
- Create a new Pull Request
*Note that all licence references and agreements mentioned in the prolog README section above
are relevant to that project's source code only.