If it's your first time here, we recommended that you follow the Grain guide to get up and running.
Grain currently only works on Mac and Linux. We are hard at work trying to integrate Binaryen and OCaml on Windows, but this is uncharted territory! Please let us know if you have this low-level expertise.
yarn yarn compiler build
This will set up the Grain runtime, standard library, and CLI.
If running tests is your kind of thing, run
yarn compiler test
If you are using
vscode as your editor, we recommend you run:
This will create local settings that point OCaml LSP to our
compiler directory. Then, you should be able to use the OCaml Platform extension!
To build the standard library:
yarn stdlib build
To build the runtime:
yarn runtime build
To link the CLI:
yarn cli link
To reset your compiler build:
yarn compiler clean
To navigate tasks available in the system:
This will display an interactive session where you can select the project and command you want.
Running Grain Programs
You can run programs using the Grain CLI:
echo "print('Hello world')" > hello.gr grain hello.gr
Alternatively, you can invoke the compiler directly:
grain compile hello.gr
and then to run the compiled program:
grain run hello.gr.wasm