A simple and minimalist programming language dedicated to developing small simulations and games (compiles to C++)
Version: v4.1.2
Developer: AUTOSELFF
Status: In Development
Platforms: Linux
Genre: Programming language, Tool
Made in: C/C++
Important! To use the built-in graphics library, you must have SDL2 and SDL_ttf libraries installed. Also, make sure you have gcc and g++ compilers installed. Kinnie does not support the underscore character in variable, function and struct names.
sudo apt install cmake libsdl2-dev libsdl2-ttf-dev gcc g++
sudo pacman -S cmake sdl2 sdl2_ttf gcc
gh repo clone autoselff/kinnie cd kinnie
cmake -B build cmake --build build
sudo cmake --install build
kinnie main.kn
Defining variables:
var x = 10 var name = "Hello" var pi = 3.14
Arrays store multiple values in a single variable. Arrays can contain numbers, strings, and other arrays.
Creating arrays:
var numbers = [10, 20, 30, 40] var mixed = [100, 200, "text", 400] var empty = []
Accessing array elements (0-indexed):
var first = numbers[0] // 10 var second = numbers[1] // 20 var text = mixed[2] // "text"
Modifying array elements:
numbers[0] = 15 mixed[2] = "new text"
Printing arrays:
var tab = [1, 2, "Hello", [3, 4]]
out "{tab}\n" // [1, 2, "Hello", [3, 4]]
out "{tab[3]}\n" // [3, 4]
.add(value) — Appends a value to the end of an array.
var tab = [1, 2, 3]
tab.add(4) // [1, 2, 3, 4]
tab.add("hello") // [1, 2, 3, 4, "hello"]
tab.add([5, 6]) // [1, 2, 3, 4, "hello", [5, 6]]
.remove(index) — Removes the element at the given index.
var tab = [1, 2, 3, 4] tab.remove(0) // [2, 3, 4] tab.remove(len(tab) - 1) // removes last element
Both methods work on nested arrays:
var tab = [1, 2, [3, 4]] tab[2].remove(0) // tab is now [1, 2, [4]] tab[2].add(99) // tab is now [1, 2, [4, 99]] tab.clear() // []
Arrays can be nested arbitrarily to create multi-dimensional structures.
Creating nested arrays:
// 1D array var numbers = [10, 20, 30] // 2D array (matrix) var matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] // 3D array var cube = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
Accessing elements:
var val1 = matrix[0][1] // 2 var val2 = cube[0][1][0] // 3 matrix[1][2] = 99 cube[0][0][1] = 42
Iterating through multi-dimensional arrays:
fun display2D(t[]) {
var i = 0
var rows = len(t)
rep rows {
var j = 0
var cols = len(t[i])
rep cols {
out "{t[i][j]} "
j = j + 1
}
out "\n"
i = i + 1
}
}
var sum = 5 + 3 var diff = 10 - 2 var prod = 4 * 5 var div = 20 / 4
var x = 100 x += 50 // x = 150 x -= 30 // x = 120 x *= 2 // x = 240 x /= 4 // x = 60
var i = 0 i++ // i = 1 i-- // i = 0
| Function | Description |
|---|---|
sin(x) |
sine of x (radians) |
cos(x) |
cosine of x (radians) |
abs(x) |
absolute value |
sqrt(x) |
square root of x |
exp(x) |
e raised to the power x |
log(x) |
natural logarithm of x |
log10(x) |
base-10 logarithm of x |
pow(a, b) |
a raised to the power b |
min(a, b) |
smaller of two values |
max(a, b) |
larger of two values |
clamp(x, min, max) |
clamp value between min and max |
round(x) |
round to nearest integer |
floor(x) |
round down to nearest integer |
ceil(x) |
round up to nearest integer |
mod(a, b) |
floating-point modulo |
lerp(a, b, t) |
linear interpolation: a + (b-a) * t |
distance(x1, y1, x2, y2) |
Euclidean distance between two points |
| Function | Description |
|---|---|
random(min, max) |
returns a random number between min and max |
sizeof(x) |
size in bytes of a value |
delay(seconds) |
pause execution for specified seconds |
if x == 5 {
out "x is 5"
}
if y > 10 {
out "y is greater than 10"
}
if a > 0 and b > 0 {
out "both positive\n"
}
if a > 10 or b > 10 {
out "at least one is big\n"
}
if not a == 99 {
out "a is not 99\n"
}
if score >= 90 {
out "A\n"
} else if score >= 75 {
out "B\n"
} else if score >= 60 {
out "C\n"
} else {
out "F\n"
}
Count loop — iterates N times:
var i = 5
rep i {
out "{i}\n"
}
While loop — repeats while condition is true:
var x = 0
rep x < 10 {
out "{x}\n"
x++
}
Use stop to break out of a loop early:
var i = 0
rep 20 {
if i == 5 {
stop
}
out "{i}\n"
i++
}
fun greet(name) {
out "Hello, {name}!"
}
greet("World")
var name = "Joe"
greet(name)
fun add(a, b) {
ret a + b
}
fun main() {
var x = 10
var result = add(x, 3)
}
Note: Arrays passed to functions are always passed by reference. Modifications inside the function affect the original array.
fun foo(t[]) {
var l = len(t) - 1
rep l {
var temp = l + 1
t[l] = t[l] + t[temp]
}
}
str Player {
var x = 0
var y = 0
var hp = 100
fun move(dx, dy) {
x = x + dx
y = y + dy
}
fun print() {
out "pos: {x}, {y} hp: {hp}\n"
}
}
Player p // str keyword is optional
p.x = 400 p.y = 300 var health = p.hp
p.move(10, 5) p.print()
Struct instances are passed by reference — modifications affect the original:
fun damage(p, amount) {
p.hp = p.hp - amount
}
fun main() {
Player p
p.hp = 100
damage(p, 25)
out "{p.hp}\n" // 75
}
Limits: maximum 32 structs, 32 fields per struct, 16 methods per struct.
out 42 // Prints: 42
out "Hello" // Prints: Hello
out "x = {x}" // Print with variable substitution
Variable interpolation in strings uses {variable_name} syntax.
add "lib.kn"
createWindow(800, 600, "Kinnie")
Parameters: (width, height, title)
clearScreen(0, 0, 0) // RGB values (0-255)
Examples:
drawSquare(100, 100, 50, 255, 0, 0) // red square at (100,100), size 50 drawCircle(200, 150, 40, 0, 255, 0) // green circle at (200,150), radius 40
setFont("path/to/font.ttf")
drawText(50, 50, "Hello World", 24, 255, 255, 255) // white text
Supported keys: "left", "right", "up", "down", "space", "a", "b", etc.
if keyPressed("space") {
out "Space pressed!"
}
if keyDown("left") {
out "Left arrow held"
}
deltaTime is a global variable that holds the time in seconds elapsed since the last frame. Use it for frame-rate independent movement:
var speed = 200 playerX = playerX + speed * deltaTime
AI was used to create this project. To learn and test Claude Code, the Haiku 4.5 model was responsible for creating documentation, comments, splitting the code into files, and implementing functionalities such as arrays and structures. I always include a note in projects where AI was used.