Skip to content

Interactive Phel REPL via PHP-WASM #131

@jasalt

Description

@jasalt

As example, Janet has a nice WebAssembly based REPL on the front-page https://janet-lang.org/. For Phel this could be achieved via PHP-WASM.

I did some earlier experimentation with it proving that the setup can work and it's not too complicated. I think it should be even simpler with the standalone Phar distribution now as a single file can be copied to the WASM "memory" and evaluated instead of workarounds I had to go through to get the full vendor/ path included with the autoloader functionality here phel-lang/phel-lang#816.

Basic version could simply load the static files required for the REPL to the front page template.

More fancy way that comes to mind would be to wrap it into Zola shortcode which could allow embedding it in different parts across the site with different placeholder contents but would require making sure multiple instances on one page wouldn't conflict e.g.

This could be a tutorial markdown file explaining some concept and 
following would inject Phel REPL in place with initial code for evaluation:

{% repl() %}
(for [x :in [1 2 3]]
  (inc x))
{% end %}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions