The Lox Playground

About the Playground

The Lox Playground lets you run your own Lox script in your browser via WASM version of BlueLox, a tree-walking interpreter implemented in Golang for Lox.

Lox is a programing language by Robert Nystrom, introduced in his wonderful book Crafting Interpreters, where he constructs a Java version interpreter(jlox) line by line, with detailed tutorial, brilliant illustrations and a full pack of jokes about breakfast.

You may find the Lox Playground helpful during your learning and coding as it may be your stage for trial-and-error and implementation reference.

The implementation of BlueLox is almost identical to jlox, except:

  • The lexer works on UTF-8 code point level instead of byte level, and it handles following escaped char: \a, \b, \f, \n, \r, \t, \v, \\ and \"
  • The error message is not the same word for word, although the efforts making them semantically equal has been made.
  • Two extra native function, sleep(millisecond) and randN(n), are added to support playground examples.

Browser WASM support is required. Raise questions and issues to BlueLox Repo if the need arises. Stars, suggestions and contributions are welcome.