Kit: a magical, high performance programming language, designed for game development. https://www.kitlang.org
Find a file
Chance Snow 2769a7a8e5 Improve metadata for VSCode Extension (#142)
* Add icon to vscode extension

* Add bugs, repo, and homepage metadata to vscode extension
2019-11-18 06:44:59 -08:00
.packages Windows package basics 2019-03-17 16:53:41 -07:00
assets That's a bit big... 2018-08-10 19:02:36 -07:00
bin/kitc Add --single-pass mode and enable KITFLAGS from toolchain definitions 2019-03-17 19:56:50 -07:00
samples Add SDL sample 2019-03-22 17:58:27 -07:00
src Fix for expression macro discovery 2019-07-02 21:30:05 -07:00
std Attempt to fix default error 2019-07-05 10:34:34 -07:00
tests one space 2019-07-05 10:34:34 -07:00
toolchains Avoid header parsing issue on some emscripten versions by undefining __cplusplus 2019-06-30 15:08:29 -07:00
utils Improve metadata for VSCode Extension (#142) 2019-11-18 06:44:59 -08:00
.gitignore Support for toolchain definitions and cross compilation 2019-03-17 16:53:41 -07:00
.travis.yml Squelch output of stack setup 2019-04-21 17:13:38 -07:00
CONTRIBUTING.md Initial implementation of traits/boxes 2018-08-15 11:15:01 -07:00
helloworld.kit Windows package basics 2019-03-17 16:53:41 -07:00
ISSUE_TEMPLATE.md Update issue template and README 2018-12-27 22:34:13 -08:00
LICENSE-RUNTIME.md clarification 2018-09-16 10:59:56 -07:00
LICENSE.md Initial commit after Haskell rewrite, with parser 2018-06-03 12:52:38 -07:00
package.yaml Protect concurrent log output with a lock 2019-03-30 09:44:12 -07:00
README.md whoops, doc mistake 2019-03-17 16:55:07 -07:00
stack.yaml Minor changes, bump language-c to 0.8.1 2018-09-11 13:30:53 -07:00

Build Status License: LGPL v3 Discord Chat roadmap on_trello Website URL: https://www.kitlang.org

Kit logo

                       ,  ,
  _,-=._              /|_/|
  `-.}   `=._,.-=-._.,  @ @._,
     `._ _,-.   )      _,.-'
        `    G.Q-^^u`u'

  oooo    oooo   o8o      ,
  `888   .8P'    `V'    ,o8
   888  d8'     oooo  .o888oo
   88888[       `888    888
   888`88b.      888    888
   888  `88b.    888    888 ,
  o888o  o888o  o888o   '888'

Kit is a programming language designed for creating concise, high performance cross-platform applications. Kit compiles to C, so it's highly portable; it can be used in addition to or as an alternative to C, and was designed with game development in mind.

Why you should use Kit in place of:

C/C++ a higher level language
Modern language features: type inference, algebraic data types, pattern matching, explicit function inlining, automatic pointer dereferencing, generics, implicits. Full control over performance: pointers, manual memory management, no GC (unless you introduce it yourself, which is easy!)
A more expressive type system, including traits for polymorphism, and abstract types, which provide custom compile-time behavioral and type checking semantics to existing types with no runtime cost. Metaprogramming via a typed term rewriting system; use rules to transform arbitrary expressions at compile time based on their type information. Create your own interface or DSL.
A sane, easy to use build system. Kit features modules, imports, and standard package structure, plus a simple but powerful build tool: manage your project via a simple YAML configuration file and kit build, kit test, or kit run. (coming soon...) Take advantage of existing C libraries without any wrappers; just include the header and directly use types/functions/variables.
function main() {
    var s: CString = "Hello from Kit!";
    printf("%s\n", s);
}

See more code examples here

Kit is pre-alpha and not all features are fully implemented; see the roadmap on Trello.

License

The Kit compiler is licensed under the GNU Lesser General Public License; see the accompanying LICENSE.md file. This applies to modifications to the compiler source itself; any code you write and compile with Kit is yours to license however you choose.

The Kit standard library (.kit files contained in this repo) is released under the MIT license.

Design goals and philosophy

  • Magic and abstracting away complexity are good! Developers should write the most concise and declarative version of their code, and use syntax transformations to convert it into what a performance-conscious developer would've written by hand.

  • Expose the necessary low-level details to write high performance code, and make it easy to abstract them away without entirely giving up control.

  • Kit provides more compile-time safety than C, but never chooses safety at the expense of ergonomics.

Building from source

The Kit compiler, kitc, is written in Haskell. Building the compiler requires GHC; the easiest path is to install Stack and run:

stack build

This will install all other dependencies locally, including a local GHC binary, and build the compiler.

To run the compiler unit tests:

stack test

To install:

stack install

This will copy the kitc binary to Stack's binary install directory (~/.local/bin on Linux); make sure this directory is part of your executable paths.

You'll also need to set two environment variables:

  • KIT_STD_PATH, pointing to the std directory in the repo
  • KIT_TOOLCHAIN_PATH, pointing to the toolchains directory in the repo

Windows setup

  • Kit is currently known to work with mingw64; anything else is unsupported at this time.

Install from package

Windows

Kit provides a Scoop package. Follow the instructions at scoop.sh to install scoop, then run scoop install 'https://raw.githubusercontent.com/kitlang/kit/dev/.packages/scoop/kitlang-prerelease.json'

macOS

Debian/Ubuntu

  • Setup Bintray's APT key:

(Debian might need to install dirmngr first - sudo apt install dirmngr, and the HTTPS transport for apt - sudo apt install apt-transport-https)

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61

  • Using the command line, add the following to your /etc/apt/sources.list system config file:

For prereleases:

echo "deb https://dl.bintray.com/kitlang/kitlang-prerelease-ubuntu bionic universe" | sudo tee -a /etc/apt/sources.list.d/kitlang-prerelease.list

For stable releases:

echo "deb https://dl.bintray.com/kitlang/kitlang-stable-ubuntu bionic universe" | sudo tee -a /etc/apt/sources.list.d/kitlang-stable.list

Or, add the repository URLs using the "Software Sources" admin UI:

deb https://dl.bintray.com/kitlang/kitlang-prerelease bionic universe

  • Update apt and install:

sudo apt update

sudo apt install kitlang

RedHat/CentOS

  • Run the following to get a generated .repo file:

For prereleases:

wget https://bintray.com/kitlang/kitlang-prerelease-redhat/rpm -O bintray-kitlang-prerelease-redhat.repo

For stable releases:

wget https://bintray.com/kitlang/kitlang-stable-redhat/rpm -O bintray-kitlang-stable-redhat.repo

- or -

  • Copy this text into a 'bintray-kitlang-prerelease-redhat.repo' file on your Linux machine:
#bintraybintray-kitplummer-kitlang-prerelease-redhat - packages by kitplummer from Bintray
[bintraybintray-kitplummer-kitlang-prerelease-redhat]
name=bintray-kitplummer-kitlang-prerelease-redhat
baseurl=https://dl.bintray.com/kitlang/kitlang-prerelease-redhat
gpgcheck=0
repo_gpgcheck=0
enabled=1
  • Then, move the config

sudo mv bintray-kitlang-rpm.repo /etc/yum.repos.d/

  • Update yum with:

sudo yum update

  • Install with yum:

sudo yum install kitlang

Hello world

After building/installing kitc:

  • Create a a new file, "helloworld.kit", and copy the following into it:
function main() {
    printf("%s\n", "Hello from Kit!");
}
  • Run kitc helloworld.kit --run to compile and run your program

Copyright (C) 2018 Ben Morris. (See the LICENSE.)