Skip to content
Axel Faes edited this page Jul 23, 2016 · 4 revisions

Cardinal is written by Axel Faes and is an extension of ThunderdogScript. It uses Wren as the base VM and adds a couple extra features. It is a small, fast, class-based, Object Oriented scripting language written in C.

IO.println("Hello, world!")

function func {
	IO.println("let's get started")
}

The codebase is about 12000 lines long which keeps the language and libraries small. It is fully documented and easily understandable. You can skim the whole thing in one sitting.

Cardinal is written fairly clean. It's written in warning-free standard C99. It compiles cleanly as C99 or C++98 and onwards.

Cardinal uses a fast single-pass compiler and a simple and compact object representation. Because of this, Cardinal is fast. A stack based VM is used in Cardinal. This keeps things simple and still retains good performance since Cardinal is heavily focused upon function calls.

Cardinal is a class based scripting languages. There are lots of scripting languages out there, but many have unusual or non-existent object models like Lua. Cardinal has first-class objects. This to allow for a flexible scripting language. Cardinal also places focus on functional programming. First class functions, lazy evaluation and closures are supported. This allows scripts to be written in a functional style. This comes in handy for behaviour scripts.

Cardinal implements fiber to be able to concurrently execute multiple coroutines.

Cardinal is intended for embedding in applications, mainly for embedding within a game engine. It has no dependencies, a small standard library, and a simple but extended C API from which functions and classes can be linked to Thunderdog. However it can also be used as a general purpose language.

Clone this wiki locally