Hello Kit

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.

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

Permalink: /n/thnmgecxlj
Last modified: Tue Sep 18 1:47pm 2018
Related: fasting rwtxt explain-to-myself-like-im-five monetize kage
Write markdown, reload page when you are done!