Skip to content

boyanio/wasm-rocks

Repository files navigation

wasm-rocks

Build Status

Rockstar is a computer programming language designed for creating programs that are also hair metal power ballads.

This is a work-in-progress transpilation for the Rockstar language to WebAssembly. You can compile to WebAssembly's text format and then compile to the binary encoding, which is also executed in the browser.

Get started

yarn install
yarn build

This will create a build folder, where you can open index.html in your favorite browser.

How does it work?

The idea is to do a AST-to-AST transformation. The sequence is:

  1. Parse Rockstar source, which procudes a Rockstar AST
  2. Transform Rockstar AST to WebAssembly AST
  3. Emit WebAssembly AST in WebAssembly Text Format (wat) or Binary Format (wasm)

Known limitations

  • Rockstar parsing errors could be difficult to understand, because of the composition of many fine-grained parsers
  • Rockstar parsing does not support arrays
  • Rockstar parsing does not support list arithmetics
  • Rockstar strings can only be used in say statements, i.e. outputting something. If you try to do some operations with strings, you might not get what you expect. This is because WebAssembly does not support string operations so far.
  • WebAssembly operations are done with 32-bit signed integers only. While floats exist in WebAssembly and Rockstar, I have decided to omit them for easier transformation.

References

Questions & contribution

You can follow me on Twitter @boyanio and ask me any questions you might have. You can directly open issues here on GitHub or sent a Pull-Requests :-)

Releases

No releases published

Packages

No packages published

Languages