Should I use llvm, or yacc/lex or what?
July 30, 2009 1:50 PM
Subscribe
Should I use llvm as a backend for my multimedia programming language, is there a better alternative?
I am working on a personal multimedia programming project, where I want to compile visual directed graphs into audio / video synthesis chains. Basically, this will be Max/MSP or PD with some "syntactic" differences, and better integration of video/image rendering. My approach right now is to parse an SVG file containing the graph and compile that into a runnable application. At this point my program is written in c and uses the expat library to load the SVG and parse it into a directed graph ready for compilation. Ideally I could eventually have a self-hosting compiler where all the source code would be expressed as visually laid out graphs, but I do understand that it could realistically be years of work to get to that stage.
I am looking for suggestions for the compilation stage. I could use csound or the supercollider scsynth backend, or even produce a valid PD file, but I think that for the kind of audio/video integration I want, and the kind of performance I would need from this sort of app, that compiling to machine code or at least low level byte code that can access system libraries would be best.
Which brings me to the question: what is my best approach here? I am under the impression that the JVM and Parrot are a bit more overhead than I want, I am skeptical of the .Net/Mono CLR route because it is a Microsoft technology and I just want as little to do with them as possible. Making a full fledged GCC extension frontend seems like a large amount of work, which leaves me leaning toward llvm.
Is this a wise choice? How usable is llvm, is there something else with better performance or a more straightforward usage scenario for multimedia?
posted by idiopath to computers & internet (10 comments total)
3 users marked this as a favorite
The overhead of the JVM is not zero, but it's actually fairly low. The modern JVM uses JIT compilation throughout the system. Benchmarks of modern Java show that it's roughly as fast as C++ for compute-intensive tasks. The benchmarks I've seen put it ahead of .NET/mono.
The one problem using the JVM is how iffy the multimedia extensions are. The JMF is littered with bugs. And, furthermore, it just doesn't do some things you'd expect it to. So you'd probably wind up writing your own extensions into some C multimedia library.
posted by Netzapper at 2:09 PM on July 30, 2009