Older blog entries for tbmoore (starting at number 9)

nmw:I wasn't talking about programming in Emacs Lisp, I was talking about using Emacs to write Common Lisp code and interact with a Common Lisp system. ilisp rocks.

Extended conses aren't going to happen. A two word data structure that's basic to the language would be transformed into a multiword structure... besides, compilers and codewalkers and such quickly transform the list-based source into a structure-based representation. If you really want properties associated with cons cells, you can do it with a hash table.

lkcl: Lisp syntax won't be scary after 5-10 minutes of playing: it's incredibly regular. Emacs enables Lisp to fly off the fingertips. And, the all-consuming passion to learn a new language is not something to be scared of, it's to be embraced!
3 May 2001 (updated 4 May 2001 at 22:10 UTC) »

Made the first net release of cparse, a Common Lisp program for parsing C header files and generating FFI definitions. Lucky Advogato readers get first dibs. I need to make an entry for it at Cliki. Now, however, I'm going to sleep.

I've been doing lots of good hacking on cparse, a Lisp program for generating foreign function interface declarations from C header files. In my last entry I breezily stated that handling sizeof() would be easy. Hah!! Anyway, getting that all right turned up parts of the C grammer that I had "forgotten" to handle. So, after much ripping apart and putting things back together, the parser is in much better shape. It now processes all of Xlib.h except for stdarg "..." function arguments, which aren't supported in CMUCL anyway. Things really are looking good for a public release later this week.

Celebrated my 35th birthday yesterday. When I was a teenager I could never imagine being so old.

20 Apr 2001 (updated 20 Apr 2001 at 17:47 UTC) »

Hacked some more on cparse, my Lisp program for parsing C headers and generating FFI declarations. I've been feeding it Xlib.h, which is a good, complicated test case. Turns out I forgot to parse sizeof(). Doh! It won't be hard to add as I already have the support in the C types code to figure out the size of everything.

Saw the best, funniest special on VH1 ever last night: a biography of Iggy Pop. Usually those things are so pompous that they suck incredibly, but in this case it was impossible for VH1 to overwhelm the wit and genius of Iggy himself. The ad for the rap compilation "Monster Booty" was an added bonus.

olandgren: The best resources for CLOS beginners tend to be books on Common Lisp. Some well-recommended ones are Paul Graham's ANSI Common Lisp and On Lisp (though the latter is out of print), and Peter Norvig's Paradigms of Artificial Intelligence Programming. Once you've grokked the basics, it's essential that you check out The Art of the Metaobject Protocol; this is at once an exposition on the design principles of CLOS, the implementation of CLOS, and powerful design strategies that are enabled by CLOS. Enjoy!

I've set the garbage collector work aside for a week and have been hacking on another home project. I've written a C header file parser for Common Lisp. This code digests header files that have been run through the C preprocessor and parses the subset of C that is likely to be in a header file i.e., most things other than function bodies. Constant expressions are supported. A parse tree, with each element of C grammer represented as a CLOS object, is produced. I've also written some code that walks that parse tree and emits the def-alien declarations for CMU CommonLisp. So, maybe we're a little bit closer to automatically interfacing with C? Maybe. I hope to make an initial release by the end of the week.

dan: Yup, this is the generational, conservative garbage collector I'm talking about. Enabling gencgc_verbose = 2 is very enlightening; you see what crap gets tenured, especially during compiles, only to later be scavenged.

I'd like to get all the ports of CMUCL to use this collector; there's no advantage of the old stop/copy collector that I can see, other than simplicity and possible lack of support for write protecting pages on some platforms.

So, last night I did some hacking on CMUCL's garbage collector, as advertised. The work I've done is pretty minimal at this point: just adding some additional statistics such as time spent collecting, page faults incurred, etc. I have a plan to tune up the garbage collector and these are the first baby steps in that direction. I think it'd be cool to let the user choose one of several GC policies: fast (generally short pauses), real time (very short pauses, 5-8ms in general), throughput (reasonable pauses but minimizing the total time spent collecting rather than the length of any one GC), and a spiffy auto GC policy that figures out which policy would be best for the current session.

CMUCL's garbage collector is written in C, and I was somewhat resigned to doing this tuning work in C too. Last night I had an "Aha!" about this: don't implement the policy code in C, which would be a drag, but export statistics and tunable parameters from the C implementation into Lisp. Lisp code that runs in an after-gc-hook then analyzes the statistics from previous GCs and diddles the parameters appropriately. Much better; after all, if I wanted to program in C I'd be hacking on the Gimp or something :)

A motivating factor for going in this direction is the fact that working on CMUCL's C code is a pain in the rear. CMUCL is a combination of a small C/assembly program providing some primitive services (such as memory allocation and garbage collection) and a much larger image of Lisp code and data. The Lisp code knows the addresses of important routines in the C code so they can be called from Lisp, but when the C code changes the addresses of those functions change too and the Lisp image has to be rebuilt. How that's done is a subject for another time, but it's somewhat more involved than just typing "make".

Just signed up; wheee! Now I'm going to go home and hack on CMUCL's garbage collector for a while.

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!