Scroll

Kal

A general purpose programming language!

Features

  • Lightweight: Fast with extremely low memory usage. Kal takes care of garbage collection.
  • Dynamic: No boundaries on types. Reassign a variable to a value of a completely different type.
  • Procedural: Abstract your code into reusable functions and split them across files.
  • Batteries Included: There is no separate standard library. All features are interpreter intrinsic.
  • Package Management: Manage third party / reusable packages centrally and share them across projects.
  • Embeddable: Embed Kal into existing C++, Python and JavaScript applications seamlessly via official bindings.
  • Independent: Kal is written completely from ground up without utilizing any third party library.
fn sort -> data {
    var i = 0.
loop i < $(len data) { var j = i.
loop j < $(len data) { if data[i] > data[j] { var [data[i], data[j]] = [data[j], data[i]]. } j = j + 1. }
i = i + 1. }
<- data. }
:sort [3, 1, 5, 4, 2] -> sorted. stdout "Sorted: " sorted "\n".

Embeddable

  • Kal is not just an interpreter. It is possible to embed Kal into other languages. With seamless integration, Kal can enhance the host language.
  • Embeddable Kal allows passing values bi-directionally, to and from the host language.
  • During installation, Kal compiles into static and dynamic object files that link with the host program.
  • Kal can be embedded in C++, Python and JavaScript programs.
#include <kal>

int main(int argc, const char** argv) {
    Kal kal = Kal();
    kal.exec(R"(stdout "Hello World\n".)");
    return 0;
}
from pykal import Kal

kal = Kal()
kal.exec('stdout "Hello PyKal\n".')
import Kal from 'jskal';
const kal = new Kal();
kal.exec('stdout "Hello JSKal\n".');
kal.close();