Small, fast, functional and scripting language for video games.
ArkScript is
- small: the compiler, and the virtual machines fit under 5000 lines, but also small in term of keywords (it has only 10)!
- a scripting language: it's very easy to embed it in your application. The FFI 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, like Java but without the OutOfMemoryException
- a functional language: every parameters are passed by value, everything is immutable unless you use mut to define a mutable variable
- powerful: it can handle object oriented programming in a very elegant way with its closures and explicit captures (see examples/church-encoding)
- promoting functionalities before performances: expressiveness often brings more productivity, but performances aren't bad at all
- 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.
{
# more or less game
(print "More or less game!")
(import "librandom.so")
(import "Math/Arithmetic.ark")
(let number (mod (abs (random)) 10000))
(mut value 0)
(mut essais 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 essais (+ 1 essais))})
(print "You won in " essais " tries")
}
Information updated 02/07/20