Build
Run
Status
Output
AST
Bytecode
About
BUILD STATUS: n/a
Press the "Build" button to compile.
Press the "Run" button to run the compiled WebBS program.
WebBS (short for "WebAssembly Better Syntax") is a simple byte-twiddling language that compiles to WebAssembly bytecode. It features: * Simple, structured syntax with block scope * Infixed math expressions with operator precedence * Typed pointers and function pointers * Immutable local variables * Minor type coersion / syntax sugar * Not much else WebBS isn't intended to be particularly useful on its own - it's a toy language. Rather, it's intended to be an educational tool for learning about WebAssembly and compiler design. The WebBS code contains an extremely simple compiler, written in pure Javascript, which runs entirely on the front end. The WebBS compiler has zero external dependencies and no build or bundling steps, and the whole thing (including this GUI) is a few hundred lines of well-commented code. It has a very simple architecture and it translates WebBS code into WebAssembly bytecode in pretty much the most straightforward possible way, with (almost) no optimization or code restructuring. It's written to be very easy to understand and modify, so programmers (especially Javascript programmers) who are interested in learning more about how compilers work can dig right in by viewing the source (either directly, or on GitHub). This editor GUI allows the user to write and run simple WebBS programs, and view the compiler's output either as an abstract syntax tree or as annotated(!) WebAssembly bytecode, so interested programmers can get a sense of how WebBS expressions are parsed and translated into the stack-machine-like WebAssembly bytecode without even reading the source. If you want to write your own lightweight DSL that runs on the front end, WebBS wouldn't be a terrible place to start (and in fact, it was initially created as the first steps toward exactly that). To get a sense of the syntax of the language, check out some example code. - Mx. Scissortail