4 ms·
Modern Prolog Implemented in Rust
- sevensor 8y agoThis has made me aware of the WAM book (http://wambook.sourceforge.net/wambook.pdf http://wambook.sourceforge.net/wambook.pdf) [PDF], which I didn't know about up to now. I'm intrigued.
- SomeHacker44 8y agoNext up: building a Rust compiler in Prolog.
- cpeterso 8y agoChalk is a PROLOG-ish interpreter written in Rust, intended eventually for use in the rustc compiler. Chalk recasts Rust's trait system in terms of logic programming. Its goal is to be an executable, highly readable specification of the Rust trait system. https://github.com/rust-lang/chalk https://github.com/rust-lang/chalk https://rust-lang.github.io/rustc-guide/traits/chalk-overview.html https://rust-lang.github.io/rustc-guide/traits/chalk-overvie...
- DannyB2 8y agoThere needs to be a pronunciation guide for: Scryer. I can think of several alternatives. I'm currently thinking of: s-crier. Rhymes with cryer. But it would be nice to know for sure.
- JoshTriplett 8y agoI'd suspect "scry-er", based on the word "scry", but I don't know either.
- mthom 8y agoYes, that's right. Scryer as in scry-ing, the practice of gazing into crystals to communicate with spirits. I wish I'd thought of a better name but it's too late now.
- criddell 8y agoWhy do $EXISTING_THING Implemented in Rust stories get so much attention here? It feels like I see one or two of these show up every week.
- mthom 8y agoImplementer here. I haven't set out to "implement an existing thing." Rather, the project is a combination of certain existing things that up to now haven't been available together in a single open source Prolog environment, SWI included. Some of these choices have far reaching implications in terms of what can/cannot be easily implemented -- see https://www.metalevel.at/prolog/attributedvariables https://www.metalevel.at/prolog/attributedvariables. SWI is much more monolithic, slow moving and not particularly ISO compliant. I don't want to reproduce the entirety of SWI and its huge ecosystem. I want a trimmed down set of features that are core to what I want out of a Prolog system, which does not include 95% of SWI. I suppose it could, but I will leave that up to others, if that's what they want. Originally, the project started because I wanted a Prolog that could talk to Common Lisp. Prolog powers the type inference engine of the Shen programming language, a Lisp with optional static type checking. Implementing Shen in CL was something of a no-brainer, because I knew I wasn't going to beat SBCL for Lisp performance. Plus, I wanted to learn the ins-and-outs of Prolog implementation and also retain some of my sanity during the Prolog-to-CL FFI part. That meant avoiding existing Prologs.
- elcritch 8y agoIntriguing project! I think you've settled on a useful set of tools as Rust can be embedded readily in another language or runtime system while still providing memory safety with a modern language features without dealing with C++ or impossible FFI scenarios. Personally I see the "X in Rust" of a lot of projects of late as a "oh I could be reasonably confident in building something solid on top of that quickly without shooting myself in the foot by messing up a C library API". It seems Rust provides a good ecosystem to implement reusable core primitives. I've been exploring how to use some simpler parts of Prolog/DatalSC in a library, which this project targets almost perfectly. Looking forward to reading how you implemented the core prolog algorithms!
- JoshTriplett 8y agoAlso see https://github.com/rust-lang/datafrog https://github.com/rust-lang/datafrog .
- xvilka 8y agoI tried to use it but wasn't able to understand how to keep the original Prolog/Datalog syntax, rather than describe it in Rust syntax.