blog.lukhnos.org

ccons Shows the Potential of clang and LLVM (Updated)

Update: Learn more about ccons with this presentation.

This afternoon I found this on Twitter: ccons is "an interactive console for the C programming language". It is, in essence, a C interpreter that you can type #include <stdio.h> and do the hello world in the editline (readline)-backed console.

There are many C and even C++ interpreters, and it's not really hard to make one that covers 80%-90% of K&R (C library not withstanding). C was, after all, designed with ease of toolchain design (notably compiler) in mind.

But the way ccons approaches it is fresh. It uses entirely clang's parser and AST stack for the heavy lifting. The diagnostics is also that of clang's. It's an excellent demonstration of how LLVM's designs—the goal of which, among a dozen others, being serving as the backend of language tools—can do amazing things for you.

I really hope this project (or forks of which) will eventually lead to an interactive console of Objective-C and the Cocoa framework. ccons also points to the direction where the next generation of clang-powered debugger will be like. New debugger for Xcode, perhaps?