This is an Emscriptened CubeScript engine. The CubeScript engine from Sauerbraten, which is about 2,500 lines of C++, was compiled by llvm-gcc into LLVM bitcode, which was translated by Emscripten into JavaScript, which you can run in your browser here. In other words, it's a script engine (for one language, and written in C++) running in another script engine (the JavaScript engine in your browser, which is incidentally also written in C++, most likely).

Why? [insert Internet meme joke here] Seriously, though, this is a test of the capabilities of Emscripten, since the CubeScript engine uses fairly complicated C++ (even stuff like manually copying vtable pointers), and since compiling an actual, complete script engine seems like a useful milestone. Also, it's a potential first step towards bringing Syntensity (which is based on Sauerbraten) to the web.

Instructions: For example, try entering the following commands in the input field below:

- echo Hello world
- x = 3
  (note the spaces around the '=')
- echo $x
- echo Another number: (+ $x (* 5 10))
  (note the prefix notation, that is the same as $x + (5*10))
- if (> $x 2) [ echo "x is bigger than 2" ] [ echo "x is not bigger than 2" ]

Check out the CubeScript docs or tutorial for more (but, they mainly talk about using CubeScript in Sauerbraten itself - much like most JavaScript tutorials talk about using JavaScript in a web browser).

Enter some CubeScript: