Extending C

I’m looking for a few good language extensions to C.

I want to demonstrate the practicality of composable language extensions, and to do that, I’m going to extend C with a bunch of neato stuff.  But I haven’t yet determined just what neato stuff that will be.

I have a number of good ideas motivated by C libraries.  For example:

  • MPI. Parallelism is always good, and there should be quite a lot of lowish-hanging fruit for a language extension for MPI.
  • Bison. Parsing is really well-addressed by DSLs, so this is an obvious choice.
  • Lua. There’s a lot of regularity to the interface between these languages that could be very well addressed by a language extension.  This isn’t extending C with Lua, but rather an extension to C that makes using the Lua C API dramatically easier.
  • OpenCL. I haven’t fully investigated OpenCL yet, but I very much imagine this will be as amenable to a language extension as MPI is. And GPU programming is another obvious hot topic.

However, all of these involve potentially complicated design work.  In the interest of laziness time-efficiency (and as a bonus, to speak more directly to the research community,) I’d instead like to implement language extensions others have already pioneered, but implement them as composable language extensions.  This way, the focus is on the advantages of this approach, and the particular extensions are already regarded as interesting.  Of course, this leaves me adrift: there are a lot of papers that extend C.  And I haven’t really paid attention to this area in the past, so I’m somewhat clueless as to which are actually regarded as good.

So, dear #lazyweb, what are your favorite papers that extend C?

This entry was posted in Dear lazyweb, Language extension, Silver and tagged . Bookmark the permalink.

5 Responses to Extending C

  1. Fabzter says:

    Did you make anything about this? the lua proposal seemed really interesting.

    • Ted Kaminski says:

      It’s a current work in progress. We’re getting close to releasing our implementation of an extensible C compiler in a couple of months, with a few toy extensions (and more to come.)

      Our initial release is going to have a partial Matlab FFI extension. It’s pretty slick, as it lets you write code in extended C just as naturally as you would writing in Matlab’s scripting language. However, I do want to at least try writing a Python FFI extension before I’m done, because I think the FFI extensions would be pretty awesome.

      I will definitely write a post when we release.

  2. manabubr says:

    About interoperability with Lua, there is this appropriately named new language: http://terralang.org/

  3. Craig says:

    The Lua C API is fine as it is. What language-level changes would you make that couldn’t be done by just wrapping it in a higher level API?

  4. did you ever release? im looking into several things whether in language before compiling, after compiling, or opcode manipulation now.. i wanted to check out your research/release..

Leave a comment