google / schism

A self-hosting Scheme to WebAssembly compiler
Apache License 2.0
1.27k stars 65 forks source link

Online playground #1

Open stereobooster opened 6 years ago

stereobooster commented 6 years ago

Hi. Thanks for starting this wonderful project. Had similar idea but thought about compiling Rust to wasm. This is even better.

I tried to create online playground - I forked repo, created gh-pages branch, renamed playground.html to index.html, but getting this error when visiting page https://stereobooster.github.io/schism/:

stereobooster.github.io/:1 Uncaught SyntaxError: The requested module does not provide an export named 'rt'
eholk commented 6 years ago

Hi, thanks for the bug report! It looks like what's going on is that in https://github.com/google/schism/commit/336a0bcfa91a525927c063d1ee54dda9798742d3 I significantly refactored the way the runtime works but never updated the playground. I'll try to get it updated, but I'm happy to review a PR if you'd rather take a stab at it.

stereobooster commented 6 years ago

I will take a look. There is a chance I can restore intended logic based on this commit

stereobooster commented 6 years ago

Fixed issue, but we still need a proper online playground. Please keep issue open for now

stereobooster commented 6 years ago

We can start with really simple one, like playground.html. Later we can get something more advanced, like:

screen shot 2018-03-01 at 22 45 18
eholk commented 6 years ago

Thanks for getting the issue fixed. I agree it'd be awesome to have a playground more like the one you listed. We could also consider something like an interactive textbook, similar to http://io.livecode.ch/learn/namin/icfp2017-artifact-auas7pp

stereobooster commented 6 years ago

I have long standing dream to reconstruct SICP in web format with interactive code snippets

mbebenita commented 6 years ago

I'd be happy to help integrate this into https://webassembly.studio/ playground if there's interest.

eholk commented 6 years ago

@mbebenita - That'd be awesome! What all would it take to integrate into webassembly.studio?

mbebenita commented 6 years ago

So, all that would be needed is to host (as in available for download) the compiler somewhere, and then writing an example template. A contributor added support for AssemblyScript in a similar way.

WebAssembly.Studio basically has two integration points. When you click Build, it loads build.ts and runs the build gulp task, and when you click Run it loads main.html in a sandbox. The rest is up to the template/project actually build and load the code. WebAssembly.Studio tries to emulate a local file system, so that users can easily download the project and run it locally.

A deeper integration where we add syntax highlighting, code completion, etc. for .ss files requires more work. Luckily, that work would also benefit other embeddings of the Monaco editor which WebAssembly.Studio depends on.

eholk commented 6 years ago

That doesn't sound too hard, and I think it'd be really useful. It might be best to wait until we get some more features, like lambdas and garbage collection, or at least label it as experimental, but I'd love to see this added to WebAssembly.Studio.

amirouche commented 5 years ago

What is blocking this?

eholk commented 5 years ago

At this point, I think it just needs someone to take the time to do it. Schism has lambdas, garbage collection, and tail calls now, as well as better error handling, so it has significantly fewer rough edges. I think now is a pretty decent time to do this.

The one downside is that now that Schism relies on experimental Wasm features, I don't think there are any browsers that can run it without using custom flags or command line arguments.

wingo commented 5 years ago

I think it's about the right time to get anyref and tail calls into chrome://flags, FWIW. I will see what I can do.

stewdio commented 4 years ago

Any progress on getting those flags into chrome://flags? I feel (perhaps naively?) that it brings those features one step closer to production :heart: Exciting stuff.