C and Lisp and Climacs and stuff


As a diversion from all the things I promised myself I’d be doing after ilc07, I’ve ended up playing with a C language syntax (mode) for Climacs.

When previewing on #lisp, the first question everyone had was “how accurately does this parse C?” Well, the answer is: at the moment, not at all. And I thought that, in the presence of C’s textual preprocessing facility*, that’s the way it would have to be. But looking briefly at emacs’ cc-mode, it looks like it ends up doing the closest thing to a full parse anyway, so I have some way to go…

More seriously, the C syntax uses the same LR parsing infrastructure that the existing Lisp syntax uses, so I’ve begun to abstract that out into its own LR-parsing mixin syntax. (I love mixins.) But it’s early days yet.

(This posted to shame me into actually delivering a patch to McClim reasonably soon rather than waiting for things to bit-rot. Which is the other thing — the wonder that is Drei means that this syntax is available to all text gadgets in McClim. Think of the possibilities…)

* “Many other changes occurred around 1972-3, but the most important was the introduction of the preprocessor. … Its original version was exceedingly simple, and provided only included files and simple string replacements: #include and #define of parameterless macros. Soon thereafter, it was extended … to incorporate macros with arguments and conditional compilation. The preprocessor was originally considered an optional adjunct to the language itself. … This attitude persisted, and explains both the incomplete integration of the syntax of the preprocessor with the rest of the language and the imprecision of its description in early reference manuals.” Ritchie, The Development of the C Language, 1993, in History of Programming Languages-II ed. Thomas J. Bergin, Jr. and Richard G. Gibson, Jr. ACM Press (New York) and Addison-Wesley (Reading, Mass), 1996

One Response to “C and Lisp and Climacs and stuff”

  1. spaceflight.nasa.gov

    an immense accumulation of commodities » Blog Archive » C and Lisp and Climacs and stuff

Leave a Reply