ArkScript version GitHub Repo stars ArkScript total downloads ArkScript Docker Pulls
Nota bene: the project is referred as "Ark" and as "ArkScript". The official public name is "ArkScript" since "Ark" is already being used by another project

Key features

ArkScript is:
  • small: the compiler and the virtual machines fit under 8000 lines, but also small in terms of keywords (it has only 10)!
  • a scripting language: it's very easy to embed it in your application. The builtin construction is quite easy to understand, so adding your own functions to the virtual machine is effortless
  • portable: it produces a bytecode which is run by its virtual machine, the same way Java does it (with a smaller memory footprint)
  • a functional language: every parameter is passed by value, everything is immutable unless you use mut to specify your need of mutability
  • powerful: it can handle object-oriented programming in a very elegant way with its closures and explicit captures (see examples/closures.ark)
  • promoting functionalities before performances: expressiveness often brings more productivity, even though performances aren't left behind
  • easy to compile: it takes less than 200ms to compile and check a complex code with a lot of branches and sub-branches of 200 lines.
  • a Lisp-like, but with less parentheses: [...] is expanded to (list ...) and {} to (begin ...). More shorthands will come in the future.
  • extensible: it is very easy to create a C++ module to use it in the language, adding functionalities

It also has:
  • macros: if/else, values, and functions
  • a REPL with autocompletion and coloration
  • a growing standard library, composed of ArkScript (under lib/std/) and C++ (under lib/ext/)
  • a lot of unit tests (but never enough), which are ran before every release to ensure everything work as intended
  • docker images:

Examples

Fibonacci suite


(let fibo (fun (n)
    (if (< n 2)
        n
        (+ (fibo (- n 1)) (fibo (- n 2))))))

(print (fibo 28))  # display 317811

                        

More or less game


(import "random.arkm")
(import "Math.ark")

(let number (mod (abs (random)) 10000))

(mut value 0)
(mut tries 0)
(mut continue true)

(while continue {
    (set value (toNumber (input "Input a numeric value: ")))

    (if (< value number)
        # then
        (print "More!")
        # else
        (if (= value number)
            # then
            {
                (print "Bingo!")
                (set continue false)
            }
            # else
            (print "Less!")))

    (set tries (+ 1 tries))
})

(print "You won in " tries " tries")

                        

More examples are available in the examples/ folder.

Contributing

Check our guide!
Our beloved contributors
Contributing to the ArkScript standard library

See Coding guidelines if you want to write ArkScript for the library (see folder `lib/std/`).
For performance reasons, some functions might be written in C++, in include/Ark/Builtins/Builtins.hpp and src/Builtins/.

Code structure
Code structure

Building ArkScript

Check out our guide!

Performances

We run benchmarks periodically, check them out!

Games

You can find a snake created in ArkScript in the folder examples/games/snake (run it from there, otherwise it won't find the font and the sprites ; you won't need to install the SFML).

The snake game in ArkScript

Controls are the arrows (left, right, up and down), the game closes itself when you successfully collect the 3 apples.

The donators

Huge thanks to those people for their donation to support the project: If your name doesn't appear here but you donated, please contact Superfola or BioTheWolff on discord to get your name to appear in this section!

Credits

This project was inspired by gameprogramingpatterns and ofan lisp.cpp