munshkr / flok

Web-based P2P collaborative editor for live coding sounds and images
https://flok.cc
GNU General Public License v3.0
261 stars 39 forks source link

Adding support for Barry (web-based bytebeat interpreter) #54

Closed claudeha closed 2 years ago

claudeha commented 4 years ago

I saw this project mentioned in TOPLAP networks, and found it interesting. I am developing a postfix bytebeat / rampcode interpreter called Barry (compiled to run in a web browser using emscripten) and was thinking about hacking etherpad to make a collaborative interface to Barry, but this seems a much better base to build on.

I've never used Typescript and my Javascript skills aren't so great, so I don't know where to start hacking. So this issue is mainly a request for a how-to guide on adding new languages.

Barry home page is at https://mathr.co.uk/barry You can try Barry non-collaboratively here: https://mathr.co.uk/barry/v2 You can get Barry's C source code here: https://code.mathr.co.uk/barry (note: Fridays are strike days)

It works like a REPL, but running in the browser: see the source code for the HTML to see how the textarea is connected to the C code (it's compiled to WASM with a JS interface). Ctrl-Enter does whole-program-compilation at the moment, switching to block-based eval would be essential for sane collaboration. I have some code to collect blocks and emit whole-program code already (Barrence) which shouldn't be too hard to port to run in the client or server (that would have the advantage of late-joining clients being in sync with the latest running code, which would be perfect for bytebeat as it has no memory).

munshkr commented 4 years ago

Hi Claude! Thank you for suggesting your language, looks interesting!

I'll try refactoring a bit the code related to local code evaluation as it is too coupled to Hydra right now (it's the only browser language implemented right now), and will write you back here. It should be fairly easy to add.

munshkr commented 4 years ago

Wrote some instructions here.

I think the first step would be to generate a compiled version and publish an npm module. That way, I could easily add it as a dependency on flok-web.

If you need help with the npm module thing, let me know. I don't have emscripten installed right now but I can try checking it out later.