Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rybla/minirkt-wasm
https://github.com/rybla/minirkt-wasm
Last synced: about 5 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/rybla/minirkt-wasm
- Owner: rybla
- Created: 2021-05-13T22:10:59.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-05-13T22:16:11.000Z (over 3 years ago)
- Last Synced: 2024-03-07T06:44:03.997Z (8 months ago)
- Language: Racket
- Size: 3.92 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# minirkt-wasm
## Organization
1. The module `parse.rkt` provides a function `parse` which converts source code
into an AST for minirkt defined as the prefab `Prgm` in the module
`grammar.rkt`.
2. The module `interpret.rkt` provides a function `interpret` which interprets a
`Prgm` and yields the result.
3. The module `compile.rkt` provides a function `compile` which compiles a
`Prgm` to the corresponding wat (webassembly text format) code.## Building
To generate the `src/main` executable:
```sh
cd src
raco exe main.rkt
```## Running
You can compile and run a MiniRkt program by the following steps:
1. Write a MiniRkt program in the `demo/examples/` folder e.g.
:8080` in your browser, enter
`demo/examples/myprgm.rkt`
2. To compile from MiniRkt to wat, run `./src/main` and enter the
`demo/examples/myprgm.rkt` file to compile when prompted.
3. To translate from wat to wasm, run
`wat2wasm demo/examples/myprgm.rkt.wat -o demo/examples/myprgm.rkt.wasm`
(`wat2wasm` is from the [wabt](https://github.com/WebAssembly/wabt)).
4. To start up a host HTTP server, run `http-server` (from
[npm](https://www.npmjs.com/package/http-server)).
5. To run the compiled wasm binary, open the address
`http://
`examples/myprgm.rkt.wasm` into the "filename" field, and click "run". The
program's output appears in the "output" field.