An embeddable Prolog scripting language for Go
1–10 of 36 posts
Re: An embeddable Prolog scripting language for Go
#2Re: An embeddable Prolog scripting language for Go
#3Re: An embeddable Prolog scripting language for Go
#4Are there any high quality prolog as a library implementations in languages such as Rust, C++, Java, Go?
Re: An embeddable Prolog scripting language for Go
#5What does the interop with go look like? Is there a story for writing prolog queries over go data structures and iterating the results. If this could be made ergonomic, it’d be very cool.
Re: An embeddable Prolog scripting language for Go
#6What are the trade offs of embedding a Prolog interpreter versus having a library that implements prolog logic without having to have another language. Are there any high quality prolog as a library implementations in languages such as Rust, C++, Java, Go?
A library that implements Prolog logic is an interpreter.
The difference here is that Prolog source code is passed in as a string as opposed to having an embedded domain specific language where you construct the abstract syntax tree.
Go is a very simple language and it doesn't have the kind of metaprogramming facilities that are typically used for creating embedded DSLs. Hence it's a reasonable choice to just have a parser and pass in the logic code as a string. There's probably a way to pass in the AST as well but it may not be very ergonomic.
Parsing the source and constructing the AST isn't very expensive and it's only done once per program, so the runtime cost isn't huge.
There are Prolog and Prolog-like embeddable interpreters and logic programming systems for many other prorgamming languages, including Rust, C++ and Java.
The best known ones are Clojure's core.logic (based on the logic interpreter in the SICP book) and Minikanren.
Re: An embeddable Prolog scripting language for Go
#7What are the trade offs of embedding a Prolog interpreter versus having a library that implements prolog logic without having to have another language. Are there any high quality prolog as a library implementations in languages such as Rust, C++, Java, Go?
> What are the trade offs of embedding a Prolog interpreter versus having a library that implements prolog logic without having to have another language. A library that implements Prolog logic is an interpreter. The difference here is that Prolog source code is passed in as a string as opposed to having an embedded domain specific language where you construct the abstract syntax tree. Go is a very simple language and…
Re: An embeddable Prolog scripting language for Go
#8What are the trade offs of embedding a Prolog interpreter versus having a library that implements prolog logic without having to have another language. Are there any high quality prolog as a library implementations in languages such as Rust, C++, Java, Go?
Also "logic" arithmetic (clpz, clpfd,...) is not the one that comes with normal languages and that breaks a lot of logical properties. Doing the sum of two variables in Java side will not respect logical properties. Standard is/2 in Prolog is also bad, but at least you can replace it with #= and that's it.
Re: An embeddable Prolog scripting language for Go
#9[0] Inspired by a HN comment a while back about Gleemin, the MTG expert engine in Prolog: https://github.com/stassa/Gleemin
Re: An embeddable Prolog scripting language for Go
#10I've been keeping an eye on this to use for the rules engine in a card game I'm writing[0]. Very excited to get back into using Prolog; I think it's fallen by the wayside a bit in the last decade or two but there's some sectors that still have strong arguments for using it if not as the main language then at least an extension language. [0] Inspired by a HN comment a while back about Gleemin, the MTG expert engine in…