Skip to content
an old compiler for Krug written in D - a prototype version
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE mit license Apr 21, 2018


This is a compiler for Krug, written in D. Though KPD itself is quite old, so it wont compile most Krug programs anymore. The actual compiler for Krug can be found under the name Caasper.

Try it out

Nothing is in working order, but some tests might run! The compiler still has a long way to go till it's stable-ish to run some actual programs.


You'll need a few bits of software to compile the compiler:

  • dmd, ldc2, - some D compiler
  • llvm, llvm-config - the llvm tool chain
  • clang, gcc, - some C compiler
  • make - GNU make


Note: Krug uses LLVM as its primary target. LLVM can be a bit tricky to build, and it's a bit of a pain to link with D. Because of this some of the flags are hard-coded for my personal machine, so the Makefiles might not work for you.


$ xcode-select --install
$ curl -fsS | bash -s dmd
$ brew install llvm


$ sudo apt-get install build-essential llvm-config
$ curl -fsS | bash -s dmd




$ git clone $ cd krug $ make $ $ ./krug b tests/x64_tests/fib.krug $ ./main $ $ ./krug e E0001 # explain error message E0001


For now let's have a nice simple hello world program! Note: this is not how the final language is intended to look, but rather how you would approach a hello world program in the compilers current state.

#module main

#{c_func, variadic}
func printf(str *u8) s32;

func main() {
	printf(c"hello world\n");
You can’t perform that action at this time.