|
|
|
|
|
by sharkbot
5766 days ago
|
|
Check out js-prolog: http://ioctl.org/logic/jsprolog-history 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. |
|
I'm planning on doing a C VM-based implementation with tabling* . I'm not sure about coroutines, and the VM will not necessarily follow the WAM design verbatim - Peter Van Roy has several suggestions for improvements in his thesis.
* Prolog-ese for memoization