Home

Hello Kit

Note: Wed Mar 27 2024. Last github commit was in 2019

Kit is a new programming language that compiles to C with many modern PL features like – strong, static type system, traits, boxes , generics and polymorphism, term rewriting etc., while still providing low level features like raw pointers.

Kit is written in Haskell. It is inspired by languages like Zig, Rust, Haxe, Scala etc.,

Compiling Kit

Kit is written in Haskell, and requires stack to to compile. Install Stack first.

cd
git clone https://github.com/kitlang/kit.git
cd kit
stack build
stack install

Add the following lines to your .bash or .zsh environmental config:

export PATH=$PATH:$HOME/.local/bin
export KIT_STD_PATH=$HOME/kit/std

Hello world

Prepare project directory:

mkdir -p ~/hellokit/src
cd hellokit

Save the following under hellokit/src/hello.kit

include "stdio.h";

function main() {
    var s: CString = "Hello from Kit!";
    printf("%s\n", s);
}

Compile hello.kit

cd ~/hellokit
kitc hello

To execute the compiled program: ./build/main. Voila!

The generated executable (on my Mac) is a mere 12KB.

Alternatively, you can compile and run the program in one step with:

kitc hello --run