Skip to content

Changes needed to compile reason/refmt with bucklescript #4377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Changes needed to compile reason/refmt with bucklescript #4377

wants to merge 1 commit into from

Conversation

jchavarri
Copy link
Contributor

I managed to compile refmt as a 1st class citizen BuckleScript library and run it in the browser successfully thanks to the bspacked Js_refmt_compiler artifact generated by ninja. See https://github.com/jchavarri/bs-refmt.

Some people have mentioned interest to have access to Reason AST using BuckleScript (cc @sgrove) and also my old self 😄 . I know the playground is not critical path, but having a version of BuckleScript that can compile refmt could allow the community to experiment and create more playgrounds & learning tools for Reason and BuckleScript.

These PR includes the changes needed in the compiler to make it work. I understand the Sys.ml change is not mergeable as is, maybe we could set BS_BROWSER env var when running ninja build -playground so the datasets get this change when building the compiler for browser?

https://github.com/BuckleScript/bucklescript/blob/5f7f45a97061b5ed9f249b63f66603506845d44b/scripts/ninja.js#L1778

@bobzhang
Copy link
Member

hi @jchavarri , are you aware of the work we are doing here? https://github.com/BuckleScript/bucklescript.github.io/pull/211

@jchavarri
Copy link
Contributor Author

Hi @bobzhang, yes I saw that progress, it looks awesome!

I'm not sure I understand the connection with this PR though, here we're adding some tags that were removed to the Obj module, these tags are needed to compile refmt with BuckleScript.

Here's a screenshot of the OCaml parsetree resulting of parsing some string on the browser, all this is done through Bucklescript, no jsoo involved (as you can see from records being compiled to JS objects):

image

@jchavarri
Copy link
Contributor Author

I managed to build a bspacked version of refmt that can be compiled with the published version of bs-platform without relying on these changes. :)

@jchavarri jchavarri closed this May 16, 2020
@jchavarri jchavarri deleted the compile-refmt branch May 16, 2020 23:30
@bobzhang
Copy link
Member

@jchavarri glad to know you get it worked. I mention it because we may not support functions in Obj module in the future (currently not good either), the only one will in the obj module you can rely on is Obj.magic since it is used a lot..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants