News for hackers. Stuff that matters.
Re:ClojureC, a compiler for Clojure that targets C as a backend by rayiner on Saturday May 04, 2013 @08:54PM (#5656977)
Generating C is quicker to write and easier to debug (can more easily read intermediate output) and doesn't require accessing a C++ api.
Re:ClojureC, a compiler for Clojure that targets C as a backend by rdmckenzie on Saturday May 04, 2013 @09:02PM (#5657002)
I can't stress the C++ api part of this enough. At the moment I'm building a Pascal compiler in Clojure for course work and when the time came to do byte code generation the first thing I looked to was the LLVM infrastructure both for ease of use and because it would trivially provide me with the ability to target non-x86 platforms.

The reality of the matter is that interacting with non-java linked libraries is a real pain from every JVM language know of. Two years ago this was posted here [https://github.com/jasonjckn/llvm-clojure-bindings], but since then LLVM has gone through two major restructurings so it didn't work out of the box and I estimated that it would take less effort to build my own naive infrastructure than to patch this one & integrate it.

As a result I'm generating code in terms of lists of newline terminated assembly statement strings that I can just print or write to a file when I'm done. While I agree that C is a sub-optimal output format in that you have to compile the output, it is also the clear lingua franca for systems programming and assembly generation these days. Generating C gives you interesting options like linking to other C codebases or your own C code the same way that cljs gives you the option of interacting with "native" javascript libraries as well as clojurescript toolkits.

Re:ClojureC, a compiler for Clojure that targets C as a backend by jared314 on Saturday May 04, 2013 @10:06PM (#5657158)
Have you looked at mjolnir[0]? It was part of a presentation at Clojure West this year. I'm not sure if the video is out yet, but the slides are[1].

[0] https://github.com/halgari/mjolnir

[1] https://github.com/strangeloop/clojurewest2013/tree/master/s...

Re:ClojureC, a compiler for Clojure that targets C as a backend by rdmckenzie on Saturday May 04, 2013 @10:13PM (#5657179)
bah just as I was finishing my register allocator...

My Firefox history indicates that I have read the Mjolnir page before, but I don't recall why I didn't use it at the time. Taking another look :-P. Thanks for the link!

Re:ClojureC, a compiler for Clojure that targets C as a backend by timbaldridge on Sunday May 05, 2013 @01:28AM (#5657532)
Author of Mjolnir here. There's some major updates going on in the "datomic" branch. If you're thinking of using Mjolnir in a project, you'll want to keep an eye on that branch over the next few months.

With Datomic, the inference engine is completely re-written in datalog. This allows for a massive code clean-up, and the code in that branch is much cleaner.

Re:ClojureC, a compiler for Clojure that targets C as a backend by pjmlp on Sunday May 05, 2013 @01:32AM (#5657542)
Why not use the Java LLVM bindings? They are usually in sync with the LLVM release.