This page is about an experimental version of the
compiler for Hyper that also has a
back end, using the LLVM project.
The version of the compiler that is advertised for download on this
website cannot generate an executable from valid Hyper sourcecode;
it only checks if the sourcefile you provide is without errors. So
to make the project more interesting (not just to get other people
interested, but to keep the fun in it for myself as well) I decided
to start developing a version of the compiler with a back end, so
that you could actually run (some of) your small Hyper programs.
Only the front-end-only version is released on this website on a
regular basis, because the compiler with back end is still very
primitive. So if you want to try the latter, you will need to
download the sourcecode directly from its development branch on
The compiler doesn't generate an executable directly yet, it only
prints LLVM assembly. A simple shell script ("simplecompile.sh") is
included to make it easier to get an executable.
When I started to use LLVM, I first wrote a simple CMake-based build
system for it. I did this because I already used CMake for the front
end, and I didn't want to switch to another build system just to
have LLVM compiled and linked to my code. That build system was
experimental and contained some hacks to get everything compiled.
I submitted my changes to the LLVM project, and after some time
someone picked them up in order to write a real CMake-based build
system for LLVM. Since then, I am using that build system instead of
the one I hacked together.
The work is still in an early stage of development. I will post
some info about my progress here.
Array codegen has been implemented. This means that I will now
have to focus on the compiler front end again, because
I need full front end support for class fields, implicit
constructors and initializer lists, before I can add support for
instances of user-defined classes in the back end.
I am currently upgrading LLVM to version 2.6.
The new implementation now almost supports all features from the
first one. Arrays are the only feature from the first back end
implementation that I still need to implement. And
"hyper-llvm-new" already has some features that were not yet
present in "hyper-llvm" (like a complete implementation
of the integral numeric types, and support for class instances
that cannot be passed by value).
Started from scratch again. Branched the front end sources into
a new branch called "hyper-llvm-new". This branch is based on
LLVM 2.4 and uses the new CMake build system from LLVM.
(afterwards I moved to the SVN version of LLVM) I will try to
reuse the code from the old "hyper-llvm" branch as much as
All integral types are implemented,
char is also supported. Chained
comparisons are working. The "main" procedure can return a
byte value for the program's exit
status. Using LLVM version 2.2 now.
All expressions except for chained comparisons are supported.
Double pointers are working. Arrays are implemented, including
I have been mostly working on the front end since the previous
status update, and version 0.3.36 has been released recently.
I have a proposal for extending the type system to support
double pointers, and I will start implementing it soon.
Most expressions are implemented. Codegen for all operations on
the built-in integral numeric types is done. A large part of the
statements can be generated.
The work will now be on hold until I can figure out what I
should do with the pointer type system. The type system
currently disallows declaring a pointer to another pointer, but
I need those for the return type of the array index operator;
otherwise I would have to introduce yet another new language
construct (`inout' return types) that would needlessly
complicate the language.
First steps done for code generation. LLVM assembly is generated
and printed to stdout. Name mangling is more or less
implemented. For each function a body is generated with at least
a return instruction at the end.
Experimental CMake build system for LLVM completed (no install