- LLVM supports multiple platforms.
- LLVM optimizes your code, and allows you to create further optimizations.
- Existing tools that work with LLVM will be able to work with my language.
- LLVM is tested and maintained, which means less testing and maintenance on my part.
Basically, you write some high-level assembly code, and LLVM does the rest of the work for you.
I've spent a long time planning out this language. However, actually writing the compiler has been pretty challenging so far. It's one thing to know you could look at an arbitrary program and compile it by hand. It's quite another to write something that does all that for you.
Since I've only made a little headway on the compiler, I'll talk a little about the language itself. My working name for the language is Virtual. Here are a few of its features:
- Virtual is designed to be performant (comparable to C++ and D).
- Virtual allows for flexible metaprogramming, including templates, and reflection.
- Plus, procedural generation of classes and functions.
- All compile-time expressions must be simplified before code is ever generated.
- This essentially allows you to do functional programming at compile-time.
- Lambda functions
- Shorthand loop syntax can replace most loops.
- C++: for (int i = 0; i < foo.size(); i++) foo[i] = i;
- Virtual: [foo.* = *],
- Tuples are first class citizens.
- and can be used as the return type of a function.
- Inline expansion can be forced, both for an entire function and for individual calls.
- Perfect forwarding is a natural consequence.
It may seem a little kitchen-sinky, but care was taken not to include conflicting features. Bringing all together will be a challenge, to say the least, but I'm looking forward to using it someday.