1.0.1 • Published 5 years ago

astexplorer-refmt v1.0.1

Weekly downloads
36
License
MIT
Repository
github
Last release
5 years ago

astexplorer-refmt

JavaScript wrapper for refmt parser to be used to analyze and show Reason and OCaml AST in astexplorer.net.

Not intended to be used as a library.

Conversion from OCaml to JavaScript for astexplorer

  • Record -> Object
  • Tuple -> Array
  • Variant -> Object with property type the name of the constructor, and then other properties with names that help understand the function of each variant argument

Development

The project requires esy to be built, you can install it using npm:

% npm install -g esy

Install the project dependencies using:

% esy install

Build the project dependencies along with the project itself:

% esy build

To test the compiled JS executable, open index.html in your browser.

To generate the production build (without sourcemaps, and minified) run:

% yarn run build:prod

The output bundle will be stored in the ./dist folder.

Running with astexplorer

  • yarn link in the project root folder
  • Clone astexplorer locally.
  • In website folder of astexplorer, call yarn link astexplorer-refmt.

Running without astexplorer

Add some logging in AstExplorerRefmt.re, for example:

log("parse", parseReason("let f = a => \"1\"; /* Comment */ let a = 2;"));

Then open src/index.html to see the parsed JavaScript object in the console.