1.0.1 • Published 7 years ago
astexplorer-refmt v1.0.1
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
typethe 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 esyInstall the project dependencies using:
% esy installBuild the project dependencies along with the project itself:
% esy buildTo test the compiled JS executable, open index.html in your browser.
To generate the production build (without sourcemaps, and minified) run:
% yarn run build:prodThe output bundle will be stored in the ./dist folder.
Running with astexplorer
yarn linkin the project root folder- Clone
astexplorerlocally. - In
websitefolder ofastexplorer, callyarn 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.