This gave me a good excuse to play around with ECL, something that I wanted to do for a while. The choice of CL as a scripting language might seem odd to some people, but I find it is optimal for me. I am aware that there are DSLs for this specific purpose (called "scripting languages") out there, and some even look like Lisp. However, I find that it takes a bit of time to find my way around a new language, and since at this point I am convinced that I will keep using CL as my main programming language, learning a scripting language that gives no additional insight would be a wasted effort.
Here is the end result. The script is really simple, and it benefited quite a bit from the comments of people on comp.lang.lisp. I like using this script, but the greatest benefit I derived from writing it is discovering what a gem ECL is. For example, I only need to use the two simple commands
(compile-file "savebody.lisp" :system-p t) (c:build-program "savebody" :lisp-files '("savebody.o"))to compile the script to a small (37K) (I am serious — it is really that small) executable file via C. A nice summary of simple compilation cases can be found here. Reading the ECL manual, I found that there are even more powerful facilities for building programs.
I am very impressed with ECL, and will definitely consider it as a remarkable implementation in the future.
ECL is really nice. I took some steps years ago to embed it in Quake 2 but never finished that project. It was also my first stop when I started with my Okra project.
ReplyDeleteAnd why use a scripting language when you can have all the power of Common Lisp? :-)
Or you could use cl-launch and not have to re-discover non-portable image-dumping features.
ReplyDeletecl-launch works great with ECL.
ECL has some very interesting features for dumping images you should be well aware of, such as generating shared libraries.
ReplyDelete