daScript

News

5th September 2020: version 0.2 released.

24 August 2020: A lot of documentation has been added.
tio.run sandbox added.

28 October 2019: Benchmarks has been updated. All lang compilers were built in LLVM8.0, architecture AVX.

15 August 2019: daScript site has been released, check it out.

daScript is high-level, statically strong typed scripting language, designed to be fast as embeddable ‘scripting’ language for C++ performance critical applications like games.

Overview

daScript is high-performance statically strong typed scripting language, designed to be data-oriented embeddable ‘scripting’ language for performance critical applications (like games or back-end/servers).

daScript is:

daScript offers a wide range of features like:

daScript is inspired by languages like Python in terms of it's explictness and readability; while it is designed to be extremely fast.

A Visual Studio Code extension that provides rich support for the daScript language, including features such as code diagnostics, code completion, code navigation, hints and more.

What Does it look like?

daScript's syntax is similar to (Typed) Python, but the language has a static strong typed nature like ML or Zig, and it's POD types are close to hardware/machine types. The following Fibonacci code snippet also relies on type inference.

def fibR(n)
    if (n < 2)
        return n
    else
        return fibR(n - 1) + fibR(n - 2)
    
def fibI(n)
    var last = 0
    var cur = 1
    for i in range(0, n-1)
        let tmp = cur
        cur += last
        last = tmp
    return cur
Also, for those who for some reason prefer curly brackets over Python-style indenting, it is also possible to write:

def fibR(n) {
    if (n < 2) {
        return n;
    } else {
        return fibR(n - 1) + fibR(n - 2);
    }
}   
def fibI(n) {
    var last = 0;
    var cur = 1;
    for i in range(0, n-1); {
        let tmp = cur;
        cur += last;
        last = tmp;
    }
    return cur;
}
(Note that within curly brackets semicolons (;) are required to separate statements).

Development state

The current version is 0.2. The language is used in Gaijin Entertainment projects in production. Until 1.0 version, there are no patches/fixes for older versions, all updates and fixes are only in master branch.

The project has been compiled and run on Windows(x86 & x64), Linux(x64), macOS, Xbox One, Xbox One Series X, PlayStation 4, PlayStation 5, Nintendo Switch, iOS and Android.

Has been tested with the following compilers with C++14 support:

MS Visual C++ 15.0, 17.0 and 19.0(x86 & x64)
Linux GCC
LLVM 7, 8, 9, 10

The documentation has to be improved.

In order to compile, it requires C++14 support.

Performance

As interpreted language it typically beats everything, including blazing fast LuaJIT.

Especially it shines in interop with C++ functions, which allows easy and nice experience to integrate new functions and types.

The total overhead over C++ of data oriented processing in interpretation is close to C++ in Debug mode (see Particles sample).

As compiled Ahead-of-Time language it is also much faster then both LuaJIT and Chrome JS (both having extremely fast Just-in-Time).

It is almost on par with naive C++ (clang-cl llvm 8.0.1 with all optimizations), usually within 10% of difference, and sometimes can even beat it!

It is worth noting that unlike Just-in-Time, Ahead-of-Time compilation can be used on any platform, including those with signed binaries executables (such as iOS or consoles).

All times are in milliseconds, all results are measured as best-out-of-20 runs on Intel Core i5.

All samples for all languages in comparison are available in GitHub

You can also compare performance online in a sandbox:
Particles in interpreted daScript vs. C++. vs. Particles in interpreted LuaJit.
(These tests above are straightforward copy-paste of examples in GitHub running on some virtualized CPU in some cloud, so only relative performance matters. Your mileage may vary.)

Work in Progress

Documentation

daScript 0.2

Online daScript 0.2 reference manual and Standard Libraries manual

Offline Reference Manual (PDF)
Offline Standard Libraries Manual (PDF)

Sandbox

Try it online implemented with tio.run fork.

Download

GitHub Repository

daScript's GitHub repository is here