Closed FemtoEmacs closed 4 years ago
I'm glad you used wamcompiler and thank you for finding some bugs! I worked on developing wamcompiler about 3 years ago. So, I don't remember well about it and can't take time for now :crying_cat_face:. But I'll welcome your pull-request!
I translated some Japanese comments in wamcompiler.lisp and README to English.
Wamcompiler is a very impressive piece of software. As far as I know, it is the first decent implementation of Prolog in Common Lisp. Many people tried and failed in this endeavor. For instance, Paul Graham, Peter Norvig, Mauro Jacob and Patrice Boizumalt were not able to implement Prolog in Lisp. You did it and deserve the credit and praise for a great work. However, there is a small bug in your implementation. I hope that you fix it as soon as possible, so that my students can start using your Prolog. Let us see an example of the problem:
It does not work. I believe that the problem lies in the cut. I have a few other suggestion for your consideration, after fixing the bug, of course.
Suggestion 1: Add prototypes in order to avoid warnings. Here are the prototypes that you should add at the beginning of the wamcompiler.lisp file:
Suggestion 2: Add general numeric operations. For instance, you can replace read-int with read-num, as shown below:
Suggestion 3: Add a few optimizations, which can boost speed by 50% at least. For instance, just by adding a declaration of type to a few definitions, I was able to boost speed by 40 percent. Here is an example:
My experience shows that one can obtain huge improvements by using arrays of numbers, instead of general Lisp symbolic expressions. I wonder if you could replace at least one of the prolog stacks with a numerical stack. I did this in the Boizumalt Prolog, and it bacame three times faster.