7 ms·
Schism – A self-hosting Scheme to WebAssembly compiler
- deleted 9y ago[deleted]
- deleted 9y ago[deleted]
- throwaway7645 9y agoIs there any chance Google might put more effort into this in the future? Scheme in the browser would be awesome. I'm guessing it is just a Google employee's pet project?
- DannyBee 9y agoThis is just a random googler side project. That's what the disclaimer means. Any effort being put into it is by that person :)
- throwaway7645 9y agoSadly that's my assumption too.
- DogestFogey 9y agoScheme in the browser is awesome. Check out Biwascheme[1] and some of the games people have made. It's also on repl.it[2] [1] http://www.biwascheme.org/ http://www.biwascheme.org/ [2] https://repl.it/languages/scheme https://repl.it/languages/scheme
- sdiupIGPWEfh 9y agoBeen waiting for someone to do this. Glad to see there's still plenty of room for contributions.
- shaunxcode 9y agoYes! Beneath the paving stones - the beach!!
- alexozer 9y agoUnder 1000 lines, too?
- kuwze 9y agoI love the fact that they chose s-expressions for the textual representation of WASM[0][1]. [0]: https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format https://developer.mozilla.org/en-US/docs/WebAssembly/Underst... [1]: https://github.com/WebAssembly/design/blob/master/TextFormat.md https://github.com/WebAssembly/design/blob/master/TextFormat...
- bcherny 9y agoCould you explain for the uninitiated?
- icebraining 9y agoWASM supports two formats; a binary format, which is the recommended for actually shipping to the browser, and a text format, mostly for humans to read and edit programs. The text format uses Lisp-style syntax, with parenthesis, e.g.: (func (param i32) (param i32) (result f64) ... ) This syntax is called S-expressions, and it has strong adherents and opponents.
- kazinator 9y agoNo, only weak, misinformed opponents with low to no experience with S-expressions.
- deleted 9y ago[deleted]
- kodablah 9y agoThere are some shortcuts and other possible ways to represent the same code/items using, as your link mentions, the linear representation and import/export shortcuts. While not the canonical text spec, I find the grammar at https://github.com/WebAssembly/spec/tree/master/interpreter#s-expression-syntax https://github.com/WebAssembly/spec/tree/master/interpreter#... The clearest to understand.
- ThatGeoGuy 9y agoFirst off: Neat project, I think this could actually turn into something super cool, especially if it could be transpiled into from another source. Think like CHICKEN, except instead of Scheme -> C -> binary, we could get $LANG -> Schism -> WASM (here, my $LANG of choice could even be CHICKEN) However, I find the choice of R6RS... odd. Is it not easier to target R7RS-small or R5RS as a baseline to begin with? I know some people have problems (or too much love) with R6RS for what may be described as religious reasons, but I find it an extremely surprising choice here given that R7RS-small is much simpler and easier to get right. Likewise, the majority of R7RS-compatible libraries would be available for free. That would add a lot for a high level language targeting WASM. Seems a strange choice, maybe the author has documented this somewhere?
- eholk 9y agoI haven't documented the choice of R6RS anywhere, so here is as good of place as any. The main reason was familiarity. R6RS is the Scheme I know best. I learned on R5RS and moved on the R6 when it was the new hotness. I vaguely was aware of R7 (I have friends that were on the standards committee), but didn't really know much more than that it had happened. There's a technical reason for choosing R6RS as well though. To me the defining characteristic of R6RS is the library system. In my mind, this has a pretty clear mapping to WebAssembly modules. Scheme libraries import some set of identifiers and export another set. WebAssembly modules are the same way, so I basically set it up so that Scheme exports and imports map directly only WebAssembly exports and imports. I'd definitely be open to supporting other Scheme versions in the future.
- e12e 9y agoI wonder how writing a wasm backend for larceny would compare to writing a new scheme. http://www.larcenists.org/ http://www.larcenists.org/
- ThatGeoGuy 9y ago> There's a technical reason for choosing R6RS as well though. To me the defining characteristic of R6RS is the library system. In my mind, this has a pretty clear mapping to WebAssembly modules. Well, this is a clear win for R6RS over R5RS, but R7RS has a much more flexible and well-agreed upon module system. One of the things about R6RS against its favour is that the module system never caught on with the major Scheme implementations (Gauche, Gambit, CHICKEN, Racket), and everyone kind of rolled their own. It's only in recent times that I've notice a lot more activity converging around R7RS. Nonetheless, thanks for responding. Familiarity is a reasonable enough reason for choosing a standard.
- deleted 9y ago[deleted]
- VikingCoder 9y ago...why didn't they use github hosting, so we can actually see it running?
- mirekrusin 9y agoWhy didn’t you post pull request with it yet so we can all see?
- VikingCoder 9y agoConfiguring your github repro so that it CAN be hosted is not something you can change through a pull request.
- mirekrusin 9y agoIt's just a branch with special name.
- eholk 9y agoSorry I didn't set this up initially, but here's a super barebones playground: https://google.github.io/schism/playground.html https://google.github.io/schism/playground.html Keep in mind there's barely any error checking, so it may or may not work for you. I hope to improve this over time, and am happy to accept patches to do that as well.
- bjoli 9y agoI can't wait to play with this when I get home! I loathe doing web development. I just can't wrap my head around it, so whenever WASM gets in a position where it can easily work with the DOM (preferrably with a decent GC), I will be all over it :) The project is in an interesting phase as well. Doing CPS transforms and implementing macros (the only thing really hard about writing a scheme).
- pjmlp 9y agoIt looks quite cool. For awhile I had the idea of applying "An Incremental Approach to Compiler Construction" to WASM, but never followed up on that. Congratulations.
- igorkraw 9y agoFirst thought I had: We finally have scheme running in the browser: https://brendaneich.com/2008/04/popularity/ https://brendaneich.com/2008/04/popularity/ Then the comments pointed me to this http://www.biwascheme.org/ http://www.biwascheme.org/ ah well
- tomcam 9y agoSomewhat unrelated question: would WebAssembly make a good intermediate language? It looks more machine-independent than I expected.
- davidgrenier 9y agoI'm confused, isn't that what WebAssembly has specifically been designed for? Unless you mean something else by "intermediate language" than what I read as "intermediate representation".
- radarsat1 9y agoI think he means, not just for web stuff. Which, of course, exists: https://github.com/AndrewScheidecker/WAVM https://github.com/AndrewScheidecker/WAVM
- tomcam 9y agoCool! Thank you.
- tomcam 9y agoThank you for the correction. I did indeed mean “intermediate representation“. I had thought WebAssembly was x86-specific
- tarcyanm 9y agoI wonder if they're aware of Ian Piumarta's Maru and Cola (http://www.piumarta.com/software/ http://www.piumarta.com/software/) - which are also tiny and self-compiling (although use C and IA32 as a basis, not JS).
- eholk 9y agoI hadn't seen those before. Thanks for the link, they look pretty interesting!
- qwerty456127 9y agoCool! BTW, there is so much LISP on HN, I just wish it could actually get some momentum in the real world of production programming...