Skip to content
/ grain Public
forked from grain-lang/grain

Compiler for Grain, the functional programming language. A modern web staple. 🌾

License

Notifications You must be signed in to change notification settings

Spencerx/grain

 
 

Repository files navigation

License: LGPL v3 GitHub version

The Grain Compiler

Grain is a strongly-typed functional programming language built for the modern web by leveraging the brilliant work done by the WebAssembly project.

This language is still a work in progress, but be sure to stay tuned, or even contribute!

For more information about the language, visit grain-lang.org.

Building

Compiler

To build the compiler, have ocaml (version >= 4.02.3), opam, and jbuilder installed and on your PATH. Then, running make will install any needed OCaml dependencies and build the compiler. Running make install will symlink grainc onto your PATH. You can run the tests with make tests.

Runtime

To build the runtime, have node (version >= 9) and npm (version >= 5) installed. Then,

cd runtime
npm install
npm run build

CLI

To make the CLI available on your path, have node (version >= 9) and npm (version >= 5) installed. Then,

cd cli
npm install
npm link --global

Running

To create a .wasm file, run the following:

grainc /path/to/file.gr -o /path/to/output.wasm

For an example of how to run the file in JavaScript, look at the files under script. You'll need to create a symlink from script/public/javascripts/grain-runtime.js to the built file in runtime/dist/grain-runtime.js, or you'll have to just copy it over to run the example.

Alternatively, you can use the CLI to run your program on Node:

grain test.gr

Copyright ©️ 2017-2018 Philip Blair and Oscar Spencer.

About

Compiler for Grain, the functional programming language. A modern web staple. 🌾

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • OCaml 95.5%
  • JavaScript 3.1%
  • Standard ML 0.5%
  • CSS 0.4%
  • Emacs Lisp 0.2%
  • Shell 0.1%
  • Other 0.2%