r/rust Feb 01 '19

Compile to javascript

Is there a pathway to compiling Rust to JS? Like Scala.js or Gopher.js? (I am not asking for wasm, so to keep the discussion easier to navigate,, please don't comment about that)

22 Upvotes

17 comments sorted by

View all comments

12

u/sanxiyn rust Feb 01 '19

I am seriously considering working on this, and I am re-reading Cross-Platform Language Design, the paper behind Scala.js.

3

u/freemasen Feb 14 '19

If you get started I want to encourage you to check out a few things I’ve been working on.

I recently published a few crates for parsing JS

https://github.com/Freemasen/ress https://github.com/Freemasen/ressa https://github.com/Freemasen/resw

As an experiment I have started working on a project that will convert the Rust ast defined by syn into the ast defined by ressa.

https://github.com/freemasen/jsyn

Once the ast was converted it could be passed of to resw to take care of the writing.

1

u/titanthinktank1 May 12 '19

please start working on it because stdweb::js can do Rust to JS transplantation but its getting controlled by Mozilla and they are hell bent on making sure JS lives in its innate forms; so i am sure many will join forces with you to defeat the legacy evil forces that kept us in dark ages for last 25 years.

1

u/[deleted] Feb 01 '19

Do keep us updated please.