compiler for the krug programming language
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.DS_Store
.editorconfig
.gitignore
.project
.travis.yml
LICENSE
Makefile
README.md
count_lines.sh
krug_screenshot.png
run_tests.sh

README.md

krug Build Status

Krug is a compiled programming language.

demo

Here's a little demo video on my youtube. The language is still very much in its infancy and has a lot of work left to be even somewhat stable.

screenshot of a krug program

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.

requirements

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

building

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.

Mac

The easiest way to get going is use homebrew:

$ xcode-select --install
$ curl -fsS https://dlang.org/install.sh | bash -s dmd
$ brew install llvm
$
$ git clone http://github.com/felixangell/krug
$ cd krug
$ make
$
$ ./krug b tests/x64_tests/fib.krug
$ ./main
$
$ ./krug e E0001        # explain error message E0001

Ubuntu

$ sudo apt-get install build-essential llvm-config
$ curl -fsS https://dlang.org/install.sh | bash -s dmd
$
$ git clone http://github.com/felixangell/krug
$ cd krug
$ make
$
$ ./krug b tests/x64_tests/fib.krug
$ ./main
$
$ ./krug e E0001        # explain error message E0001

Windows

TODO!

examples!

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;

#{no_mangle}
func main() {
	printf(c"hello world\n");
}
What I want it to look like:

Something along these lines:

#module main

#load "std/io.krug"

func main() {
	std::Println("Hello, {}!", "world!");
}

Each file specifies what module it is a part of. Krug source files are loaded with a relative path. Modules are access with the :: colon operator. The identifier for a function is capitalized as the privacy for function identifiers is specified with the case of the identifier. The standard library is nice and flexible!

why?!

Krug is a fun little side project. The goal is to create a somewhat polished compiler that can compile any Krug program you throw at it.

roadmap?

This is a side-project I do in my free time so development is done in short lived bursts when I can.

Here's a roadmap for the language in some sort of order:

  • Todo write up a new roadmap!

Disclaimer: some of these are realistic and some are... not.