September 14th, 2024

Prolog-rs: Minimal Prolog implemented in Rust

Prolog.rs is a minimal Prolog interpreter in Rust for learning purposes, featuring over 350 unit tests, basic constructs, and data types, but lacking performance optimization and some Prolog features.

Read original articleLink Icon
Prolog-rs: Minimal Prolog implemented in Rust

The GitHub repository Prolog.rs features a minimal Prolog interpreter developed in Rust, aimed at facilitating learning about Prolog. It implements a subset of Prolog functionalities and is not performance-optimized. The interpreter has been rigorously tested with over 350 unit tests, including those for the "99 Prolog problems" and ISO Prolog consistency. Users can interact with the interpreter through a `Justfile`, allowing commands to run tests, build the binary, evaluate Prolog files, or start a REPL. The interpreter supports basic data types such as atoms, integers, variables, and compound terms. Key Prolog constructs like facts, rules, and questions are also implemented, along with basic features including unification, logical operators, and arithmetic operations. However, the implementation has limitations, as it only covers a subset of Prolog features, lacking support for strings, floats, and custom operators. Additionally, it is not tail-call optimized, which may result in stack overflow for complex queries. For further details, the repository is accessible online.

- Prolog.rs is a minimal Prolog interpreter written in Rust for educational purposes.

- It includes over 350 unit tests to ensure functionality and consistency.

- Users can execute commands via a `Justfile` for testing, building, and running Prolog files.

- The interpreter supports basic Prolog constructs and data types but has notable limitations.

- It is not optimized for performance and lacks certain Prolog features like strings and custom operators.

Link Icon 2 comments
By @sevensor - 7 months
Looks like a neat learning project!

Doesn’t mention Scryer prolog (https://news.ycombinator.com/item?id=28966133) but I’m guessing it’s not meant as an alternative