A web interpreter for Nuru -- A Swahili Programming Language built from the ground up -- powered by WebAssembly.
Prerequisites
- Go (^1.19.0)
- Node.js (^18.13)
To build the wasm binary from the go interpreter:
- Change directories to
/wasm
cd wasm
- Install the required go dependencies
go mod tidy
- Create a go vendor folder
go vendor
and copy the modified builtins.go
into the evaluator package
cp ./modified/builtins.go ./vendor/github.com/NuruProgramming/Nuru/evaluator/
or if you are on Windows
copy ./modified/builtins.go ./vendor/github.com/NuruProgramming/Nuru/evaluator/
- To build the wasm binary
wasm && GOOS=js GOARCH=wasm go build -mod=vendor -o main.wasm
or if you are on Windows:
$env:GOOS="js"; $env:GOARCH="wasm"; go build -mod=vendor -o main.wasm
notice the
-mod=vendor
flag in the wasm build. This is to build the project using the vendored dependencies (which now includes the modified builtins).
Powered by Svelte. To work with it:
- Change directories to
/app
cd app
- Install dependencies
npm i
- To start a development server:
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
/package.json redefines the above commands as scripts you can run from the root folder.
npm run dev #runs the dev server
npm run build:wasm #Builds the wasm binary and copies it over to the web app
npm run replace #Replaces the default Nuru builtins with browser friendly versions
If you are on windows, edit the build:wasm & replace scripts to replace
cp
withcopy
orCopy-Item
Coming soon
- Support for user inputs (
jaza()
) - Syntax highlighting for Nuru code