Projects
 

Kaba

Active: since ~2005 git

A powerful programming language

The language is a simplified version of c++ with syntax inspired by python. The compiler will generate x86 opcode for execution.

Some language features:

  • classes (single inheritance)
  • virtual functions
  • lambdas
  • simple dynamic arrays
  • easy function pointer syntax
  • generics (still experimental)
  • interoperability with c++ programs

History

Kaba began as an interpreted script language for the game engine and used C as its syntax. Then came a series of ludicrous adventures of having c++ programs reading and modifying the memory of their own functions during runtime in order to understand how computer architecture works.

This lead to a primitive compiler. The first version could only build code by combining predefined blocks. Later an intermediate stage of assembler was added, making the process more complicated but reducing redundancies in the code and allowing to use registers more efficiently.

Syntax

See: wiki:kaba syntax

main()

Like in c, the starting point is a main() function:

func main()
    print("hello")

for

Kaba's dynamic arrays are easier to use than in c++. Also looping over an array behaves like in python:

var list: int[] = [1,2,3]
for i in list
    print(i)

Although, there is a shortcut when looping over a fixed range:

for i in 0:100
    print(i)

The type system is c++, but type names are more consistent. Declaring an array is int[] list instead of int list[]!

let

When declaring a variable, the type can be guessed:

let list = [1,2,3]

Classes

The class system works like in c++, also with optional virtual functions. But overriding functions can only be done explicitly:

class Base
    func virtual f()
        print("A")

class Derived extends Base
    func override f()
        print("B")

Inspired by python, classes can implement operators:

class C
    i: int
    func mut __iadd__(other: C)
        i += other.i

Objects can be created on the stack or heap:

var a: C
let b = new C()
a.i = b.i

In both cases, elements can be accessed via b.i ("dot") instead of b->i.

Exceptions

try
    raise(new Exception("bla"))
except Exception as e
    pass

Dynamic types

Kaba is statically typed but offers a wrapper class for dynamic types:

var a: any = dyn([1, "x", [2, true]])

# dictionary
var b: any
b["a"] = "test"
print(b["a"])

Libraries

Kaba comes with integrated libraries for graphical user interfaces (gtk backend), 3d graphics (OpenGL and vulken), as well as math (3d linear algebra, fft), networking and threads.

A list of all classes and functions can be found here: wiki:kaba reference

Platforms

The compiler can generate (32bit) x86 and amd64 opcode. Some basic features also run on ARM.

On linux the code is (mostly) binary compatible with gcc. This means, a c++ program can use kaba to run scripts, have the script create objects and functions and treat those like any regular c++ objects and functions. Also the program can export objects and functions to be used by the script.

Windows compatibility (with Visual c++) used to exist, but has not been maintained.

© by Michael Ankele 2026