Skip to content

Latest commit

 

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Klein

A small, minimal, embeddable scripting language.

Klein is meant to fill the same niche as Lua—dead simple and highly embeddable scripting—with some improvements, notably:

  • A simple TypeScript-like type system
  • Improved ergonomics for iterators, tables and lists
  • More built-in functionality for tables and lists
  • Less ways of doing the same thing

At a glance, Klein is a statically, structurally typed, interpreted, multi-paradigm scripting language.

Installation

Building From Source

Klein can be built from source on any machine that can compile standard C at at least C99:

git clone https://github.com/klein-language/klein.git && cd klein && make install

Installation Customization

All customizable flags can be found at the top of the makefile.

The default compiler is clang, but any C compiler can be used by passing it to the CC variable, i.e.:

make install CC=gcc

Klein is written using only standard C without compiler extensions, so it can be compiled with any C compiler.

The default location for the executable is /usr/bin, which can be set with LOCATION:

make install LOCATION=/home/me/.klein

Note that when changing this option, the location passed will be automatically created if it doesn't exist, but it won't be automatically added to your $PATH.

Embedding & Bindings

Klein is designed to be embedded into other languages. In general, any language that can link a static library (.a) or a dynamic library (.so, .dll) can embed Klein.

C

To use Klein in a C project, copy the klein.a static library and the klein.h definitions in the bindings/c directory into your project, and include klein.a when linking your object files. An example C project embedding klein can be found in tests/c.

You can also build the libraries from source if you'd like:

git clone https://github.com/klein-language/klein.git && cd klein && make c-bindings

This will do a full clean compilation of the interpreter and place the header file, static library, and dynamic library in bindings/c.

Rust

Klein is available through the Rust crate cklein. See the rust bindings for more information.

About

A dead simple embeddable scripting language.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages