Running Your First Program

In this first section, we’ll go through the steps involved in installing ReasonML, creating a project, and building and running the code.

Installing ReasonML

The ReasonML compiler takes your code and translates it to OCaml’s abstract syntax tree (AST)—the intermediate stage of compilation. The AST code can be compiled into native code or JavaScript. In this book, we’re focusing on JavaScript. The task of translating to JavaScript is handled by the BuckleScript compiler, which produces (surprisingly readable) JavaScript code. You can get ReasonML and BuckleScript by installing bs-platform (the bs in bs-platform stands for BuckleScript), and the easiest way to do this is to use a package manager like npm[10] or Yarn. ...

Get Web Development with ReasonML now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.