Code
Console output
Canvas output

chasm is a very simple programming language which I developed to accompany a talk at FullStack Conference NYC. It is not intended to be a fully featured language; rather, its purpose is two-fold:

  1. Introduce the basic building blocks of compilers - and show that they aren't that scary or difficult!
  2. Reveal some of the inner working of WebAssembly, a new and exciting language / runtime that I think people need to know more about.

The chasm compiler is written in TypeScript, you can try it out using the above editor. When you click either of the 'run' buttons above, the code is tokenised then parsed into an Abstract Syntax Tree (AST). If you use the interpreter this AST is executed by a JavaScript interpreter. If you use the compiler, this AST is compiled to a WebAssembly module then executed via the browser's WebAssembly runtime.