kOS-C: A Typed Language for kOS

Welcome to the documentation of kOS-C, a typed language for the Kerbal Operating System (kOS) mod for Kerbal Space Program. This project is an add-on providing an alternative frontend for the untyped scripting language employed by kOS.

What is kOS-C?

kOS-C is a programming language with a syntax inspired by other C-like languages such as C++, C#, etc. It comes with a compiler that transforms kOS-C code into kOS scripts that can then be used inside Kerbal Space Program without further modifications.

In contrast to kOS, it provides a static type system with support for generic types and a module system. Additionally, the code generated by the kOS-C compiler optionally renames identifiers in order to make the resulting code shorter. This is especially important with the CPU parts unlocked in the early game which only provide limited storage capacity.

Why another language?

Since I personally believe that static (type) checking of programs is incredibly useful for preventing common mistakes I was not quite satisfied with the available options. Creating a language that compiles to the scripting language employed by kOS seemed to be the easiest route in fixing this “problem”.

Moreover, kOS-C is planned to be interoperable with kOS scripts. That means that existing kOS code can be easily integrated into kOS-C programs, and the code generated by kOS-C should be usable by other kOS scripts.

How to install kOS-C?

In short: there are prepackaged binaries in the GitHub repository. A more detailed guide to building kOS-C can be found in the section Installation.