https://github.com/gabbhack/nimplay
Fork of Nim Playground with VM in WebAssembly
https://github.com/gabbhack/nimplay
Last synced: 3 months ago
JSON representation
Fork of Nim Playground with VM in WebAssembly
- Host: GitHub
- URL: https://github.com/gabbhack/nimplay
- Owner: gabbhack
- Created: 2023-04-25T13:37:02.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-12-23T04:32:50.000Z (about 2 years ago)
- Last Synced: 2024-12-28T15:30:00.857Z (about 1 year ago)
- Language: Nim
- Homepage: http://nimplay.eu.org/
- Size: 6.45 MB
- Stars: 13
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NimPlay
NimPlay is a fork of https://github.com/PMunch/nim-playground-frontend/ with Nim VM in WebAssembly.
# Structure
- src/frontend.nim - frontend and communication with the worker, compiled to JS via `nimble frontend`
- src/nimscript.nim - Nim VM, exports `runScript` function for JS, compiled to WASM and JS via `nimble wasm`
- public/worker.js - receives code messages from the main thread and returns the result, included in wasm js at compile time
`nimble wasm` will generate 3 files for you:
nim_version.wasm - actually run Nim VM
nim_version.js - provides js api, configures the file system. Compiled with public/worker.js
nim_version.data - Nim stdlib
nim_version - current Nim version on your machine
NimPlay supports switching Nim versions. To do this, you need to generate this 3 files for each version, and add the version number separated by commas to `nim.cfg`
# Build
1. Install Nim > 1.6.0 with [choosenim](https://github.com/dom96/choosenim)
2. Install [emscripten](https://emscripten.org/docs/getting_started/downloads.html)
3. Run `nimble frontend`
4. Run `nimble wasm`
5. Serve `public/index.html`. For dev you can use `emrun public/index.html` cmd