Grain is a new programming language that compiles to WebAssembly via Binaryen. For more information about the language, check out grain-lang.org.
If it's your first time here, we recommended that you follow the Grain guide to get up and running.
There are tons of ways to contribute to Grain. Check out our contributing guide for more info and come chat with us on Discord! All contributors are held to our contributor code of conduct.
To build Grain, you'll need Node.js v14, Yarn, and CMake. To get everything set up, run:
yarn
yarn setup
yarn compiler buildThis will set up the Grain runtime, standard library, and CLI.
If running tests is your kind of thing, run
yarn compiler testIf you are using vscode as your editor, we recommend you run:
yarn vscodeThis 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 buildTo build the runtime:
yarn runtime buildTo link the CLI:
yarn cli linkTo reset your compiler build:
yarn compiler cleanTo navigate tasks available in the system:
yarn runThis will display an interactive session where you can select the project and command you want.
You can run programs using the Grain CLI:
echo "print('Hello world')" > hello.gr
grain hello.grAlternatively, you can invoke the compiler directly:
grainc hello.grCopyright ©️ 2017-2020 Philip Blair, Oscar Spencer, & contributors.