https://github.com/felixangell/kpd
an old compiler for Krug written in D - a prototype version
https://github.com/felixangell/kpd
compiler programming-language
Last synced: 6 days ago
JSON representation
an old compiler for Krug written in D - a prototype version
- Host: GitHub
- URL: https://github.com/felixangell/kpd
- Owner: felixangell
- License: mit
- Created: 2017-09-29T22:57:12.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-07-09T21:52:34.000Z (over 6 years ago)
- Last Synced: 2024-12-06T22:34:59.203Z (about 1 year ago)
- Topics: compiler, programming-language
- Language: D
- Homepage:
- Size: 12.5 MB
- Stars: 44
- Watchers: 8
- Forks: 1
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KPD
This is a compiler for [Krug](//krug-lang.org), 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](//github.com/krug-lang/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.
### Requirements
You'll need a few bits of software to compile the compiler:
* `dmd`, `ldc2`, - some D compiler
* `clang`, `gcc`, - some C compiler
* `make` - GNU make
### Setup
#### Mac
```bash
$ xcode-select --install
$ curl -fsS https://dlang.org/install.sh | bash -s dmd
```
#### Ubuntu
```bash
$ sudo apt-get install build-essential
$ curl -fsS https://dlang.org/install.sh | bash -s dmd
```
#### Windows
TODO!
### Installing
$ 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
## 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.
```krug
#module main
#{c_func, variadic}
func printf(str *u8) s32;
#{no_mangle}
func main() {
printf(c"hello world\n");
}
```