|
|
|
|
|
by silentbicycle
5769 days ago
|
|
Perl isn't really my thing* , but I'll take a look at how they're implemented. I was thinking a C library with a C API that will make it easy to use from Lua, Python, Ruby, etc.
Yaswi is probably just a wrapper to SWI-Prolog. There are a few of those, and I'm tempted to write one for Lua. I think designing a Prolog-like language primarily for embedding, rather than wrapping a standalone Prolog, will have an interesting effect on the design though - Lua, for example, benefits tremendously from being able to leave certain issues to C. An embedded logic language could likewise focus on what it does best. * Somebody is probably going to pop out of the woodwork and say that my impression of Perl is based on Perl 10 years ago. They're right, as that's roughly when I switched to Python. It'd be tough to convince me to switch back, though. I'm fine with awk for "tiny Perl script" hacks, and prefer other languages for larger stuff. |
|
It's a quick-and-dirty implementation of a Prolog interpreter, but it's a great resource for prototyping. JavaScript ports very well to Lua, so you should be able to port the code in a busy afternoon.
I made a couple of suggestions to increase the speed of the interpretation, but I'm not sure Jan ever integrated them into the code. The big one was using a trace to destructively modify environments rather than recreating them on choice points; WAM and tabling would be great, but it's a non-trivial piece of work following Warren's tech report, even with the help of the (very good) tutorial.