nuprl / Stopify

A JS-to-JS compiler that makes it easier to build Web IDEs and compile to JS.
https://zenodo.org/records/10408254
BSD 3-Clause "New" or "Revised" License
173 stars 12 forks source link

basic support for output of the racketscript compiler #500

Closed arthertz closed 3 years ago

arthertz commented 3 years ago

A few weeks ago I was part of a call with @arjunguha and Sam Tobin-Hochstead about adding support for Racketscript, a subset of Javascript compiled from the Racket language.

We ran into some issues with using Spotify on the generated code, but with a few small changes we could run programs like a factorial function, taking advantage of tail calls and other Stopify features.

From what I remember talking to Arjun, there isn't reason anymore for TextDecoder to be unavailable on Node, or for TextEncoder to be excluded from knowns. This should clean up some minor bitrot.

The addition of g.exports is to support the transpiled version of some ES6 features (I believe named exports), stopify would error without it.

This PR should have everything we talked about that day, and after merging, the compilation output of small Racket programs should work with Stopify.

To show that this does something, I made a small test repository which compiles a Racket program then runs Stopify on it. This PR should contain the changes needed to get Stopify working with the test program.

I don't know much about Stopify's internals, so I'd love for someone to take a look at this and make sure this won't break anything.

arjunguha commented 3 years ago

I am going to merge this. I had to upgrade the GH Actions machine to Node 14. That upgraded Chrome to Chrome 95. But the ChromeDriver on NPM is still at 94. sadface.