Ki is a low-level programming language written from scratch, completely independent from libc and llvm.
  • C 99.7%
  • Makefile 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-01 21:08:12 +01:00
editor Quick and dirty vsix 2026-08-22 22:53:51 +01:00
examples Add cat example 2026-08-28 21:29:41 +01:00
guide Update 01_variables_and_primitive_types.md 2026-08-27 23:09:38 +01:00
lib Add random numbers 2026-08-31 21:43:32 +01:00
src Increment tag 2026-09-01 21:08:12 +01:00
tests Add random numbers 2026-08-31 21:43:32 +01:00
.gitignore Fix a ton of object command module file production, fix C linkage issues, add ncurses example 2026-08-21 22:32:00 +01:00
LICENSE Create LICENSE 2026-08-22 22:54:31 +01:00
Makefile Add basic.ki caching and libki.a usage on installation 2026-08-20 22:00:21 +01:00
README.md Add -ro-strings option, temporarily restrict stack struct returning and passing by value, catch missing and unexpected return values 2026-09-01 21:07:15 +01:00

Ki v3

Ki is a low-level programming language written from scratch. It's completely independent from libc by using its own self-hosted libraries, and independent from llvm by using a custom backend. It aims to be a fun, non-production improvement on C.

Warning

Ki is still in early development, expect breaking bugs and missing features.

Notable Features

  • Modules
  • Default values
  • Inferred types
  • Decorators
  • Builtin strings
  • Builtin markdown generator
  • Builtin IR string representation generator
  • Blazingly-fast compile times

Installation

$ git clone https://github.com/notjoshki/ki-v3.git
$ cd ki-v3
$ sudo make install

Examples

Hello world:

main() {
    print("Hello, world!\n");
}

Print the alphabet in ascending order:

main() {
    for character := 'A'..='Z' {
        print_char(character);
    }

    print("\n");
}

Greet the user:

main() {
    name := input("What is your name? ");
    print_format("Hello, %\n", name);
    delete_string(name);
}

You can find more advanced examples here, or see the compiler tests.

Usage

ki <command> [options...] <file>
Command Description
build Produce an executable
document Produce a markdown file
ir Produce an IR file
object Produce an object file
source Produce an assembly file
Option Description
--help Show this information
--version Show the compiler version
-as-flags <...> Specify flags to pass during assembling
-doc-exported Show only exported symbols in documentation
-freestanding Don't use the standard library or initialize the heap
-g Build with debugging information
-ir-explicit Generate IR in explicit form
-ld <path> Specify the linker to use in compilation
-ld-flags <...> Specify flags to pass during linkage
-o <name> Specify the output filename
-ro-strings Disable auto-allocated string constants
-source-libs Show library externs in assembly source code
-unopt Disable optimization

License

Ki is distributed under the BSD 3-Clause license.