LLVM generates code that generates code LLVM generates code that generates code

Posted by jstrecker on 2012.11.16 @ 14:53

Filed under:

Back from last week’s LLVM developer’s meeting, I’d like to talk about one of my favorite features of LLVM .

LLVM is the compiler infrastructure that underlies Clang, Vuo, and many other projects. It’s a set of libraries to help you build compilers (and more). Among other things, LLVM provides a C++ API for generating LLVM Intermediate Representation (LLVM IR) code. LLVM IR is an assembly language for a hypothetical computer. LLVM IR code can be either interpreted or compiled down to native code.

So LLVM provides this C++ API for generating LLVM IR code — but it doesn’t stop there. LLVM can also generate C++ code that generates LLVM IR code. In other words, LLVM can literally write part of your compiler for you! [more...]

Kosada is Developing a Next-Generation Programming and Performance Environment for Multimedia Artists

Posted by jmcc on 2012.11.02 @ 22:48

Filed under:

Kosada is developing Vuo, a next-generation visual programming environment. It will enable multimedia artists to create powerful real-time audiovisual projects, data visualizations, and apps — all without writing code.

With Vuo, non-programmers will be able to create their own multimedia software for interactive art and music performances, animations, visualizations, games, special effects, museum exhibits, kiosks and other artistic projects. Rather than writing code in a traditional computer language, the composer will drag and drop building blocks onto a canvas, connecting those blocks with cables to create the composition. Unlike most programming environments, artists will be able to interact with their Vuo compositions while they are running, allowing for live improvisation. [more...]

Compiling code with the Clang API Compiling code with the Clang API

Posted by jstrecker on 2012.08.15 @ 11:46

Filed under:

Have you tried Clang yet? Clang is an open-source compiler, under active development, that aims to replace GCC for compiling C, C++, and Objective-C. Compared to GCC, Clang is faster, while generating comparably fast code, and prints more useful error messages.

Clang is also better for developers who want to compile code programmatically. Unlike GCC, Clang is designed to be both a tool and an API. That makes Clang’s source code easier to understand and reuse. And, for those of us working on projects incompatible with GCC’s GPL license, it’s good to know that Clang is distributed under the BSD license.

Kosada is working on a cool new project that’s built on top of Clang and its underlying framework, LLVM. While using Clang for this project, I’ve been pleased to see how simple it is to write code that builds other code. Simple in retrospect, anyway! The code I wrote turned out to be simple, but it took lots of digging through the Clang source code to figure out what to write. So here’s my first contribution to the Clang community: two examples of using the Clang API to build code programmatically. [more...]