I want to make a compiled language. I am currently evaluating backends. So far I am looking at C because of its speed of execution, compiling, and a small, easy to use compiler called TCC.
Having read the discussions here about using it as an intermediate language, I am trying to think about how to make it compatible with garbage collection, and handling exceptions. So far, I think I can solve both, but with much overhead.
Here are some of my thoughts on the other possible backends:
- Assembly: unportable and a total pain to program in.
- .NET: Feels really slow. 5 seconds to start up and 5 seconds to evaluate 1+2 on Ironpython and Boo. Unable to run without large library.
- JVM: Feels a bit slow. No access to binary libraries. Unable to run without large library.
- LLVM: No windows support. I hear that compiled executable size is 16 mb+
- C--: looks underdeveloped.
- C++: possibly. Can't find a nice small free one I can bundle with.
Can any of you change my mind or have more to add to this list?
Edit
I've been experimenting with LLVM recently. I found out that they have precompiled binaries and that it is possible to compile to native assembly.
http://www.antlr.org/wiki/display/CS652/Generating+machine+executable+binaries+with+LLVM
Here are the steps:
- Run llvm-as on LLVM Assembly, which yields a LLVM bytecode file.
- Run llc on the LLVM bytecode file to yield an assembly file.
- Run an assembler on the assembly file to yield an object file. (or run llvm-ld which seems to depend on an externally installed c compiler)
- Compile to executable with gcc etc.