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:

Extremely blazingly fast . daScript can be compared with compiled or JIT language even in interpreter mode, always faster than dynamic interpreted scripting languages like Lua. In AOT it is often faster than naively written C++ (due to SSE-friendly POD-types) and beats best JIT VMs (V8 or LuaJIT). You will never need to rewrite daScript code to C++ to optimize your application!

. daScript can be compared with compiled or JIT language even in interpreter mode, always faster than dynamic interpreted scripting languages like Lua. In AOT it is often faster than naively written C++ (due to SSE-friendly POD-types) and beats best JIT VMs (V8 or LuaJIT). You will never need to rewrite daScript code to C++ to optimize your application! Safe . It is static typed languages with all it's benefits (most of Lua/JS errors that will break application in runtime won't even compile), but due to generics and type inference it is easy and fluid. Safety is the next key pillar of daScript design, so in many cases it is safier than languages like C++ or Java.

. It is static typed languages with all it's benefits (most of Lua/JS errors that will break application in runtime won't even compile), but due to generics and type inference it is easy and fluid. Safety is the next key pillar of daScript design, so in many cases it is safier than languages like C++ or Java. Real embedded scripting language. It has no dependencies (you only need C++14 compiler), super easy-to-use and safe interop (all embedded scripting languages supposed to call native code).

daScript offers a wide range of features like:

amazing performance

strong static typing

instant hot reload

Ruby-like blocks

semantic indenting

lexical scoping

high performance interpretation

Ahead-of-Time compilation (optimization for release build)

generators

generics and type inference

optional types (i.e. pointers)

native HW friendly POD types

C++ friendly and fast interop

semi-manual memory management

fast and easy-to-reset execution context, allowing automatic burst free memory management for stored procedures

No memory leaks with no GC/reference counting cost.

No memory leaks with no GC/reference counting cost. extendable type and function system

cheap multi-threading support - explicit separation of execution context and code context.

Open Source BSD licence

powerful embedding API e.g. functions can be defined by scripts or in C++ e.g. objects can fully exist in the Context or be bound to native code and more



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

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). Also, for those who for some reason prefer curly brackets over Python-style indenting, it is also possible to write:(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

Interpetation optimizations

AOT optimizations

Additional and embedding documentation

Generators/coroutines

Pattern matching/variants

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