Contents

Searching...

Install Kal

...or rather compile it from source

Kal has no third-party dependency, hence it's very convenient to compile it from the source code. Kal uses a build script to manage every aspect of compilation and installation including the Kal interpreter, tests and libkal.

Please note that Kal compilation and installation is tested on Linux and therefore this document highlights installation on Linux only. Installation on macOS should be similar. Windows users are recommended to use Windows Subsystem for Linux (WSL).

Make sure you have required Linux utilities installed/updated before compiling Kal.
$ sudo apt install \
    git bash gcc g++ -y
  1. Clone the Kal repository. Shallow clone for faster download.
    $ git clone --depth=1 \
        https://www.github.com/KILLinefficiency/Kal
  2. Optionally run tests to make sure the latest code is stable.
    $ ./build.sh test
  3. Compile the Kal interpreter. This will put the compiled binary in the ./bin folder.
    $ ./build.sh compile
  4. Build libkal. This will put libkal and the associated files in the ./bin folder.
    $ ./build.sh embed
  5. You can choose to install Kal and libkal on your system directly. [Recommended]
    $ ./build.sh install
    This installs:
    • the Kal interpreter in the /usr/local/bin/ directory.
    • libkal (libkal.a) in the /usr/local/lib/ directory.
    • libkal (libkal.so) in the /usr/local/lib directory.
    Running ./build.sh install will prompt for password via sudo for installing the mentioned files to the appropriate location.
Let's write and run a simple Kal program.
stdout "Hello World!\n".

hello.kal

Navigate to the directory where the source file exists and pass it to the Kal interpreter.
$ kal hello.kal
You can launch a Kal shell and run commands on the go.
$ kal
Shell usage example:
Kal [1]: stdout "Hello World\n".
Hello World