Is there a Motoko playground for devs?

Hello,
I am starting to learn Motoko and I am walking through the documentations which is fantastically written, but I am missing a playground where I want to just play with the code.
Is there something like that or even a REPL where I can write Motoko code and just run without having to run all the setup?
I am talking about something like this https://www.typescriptlang.org/play

2 Likes

If you’re already reading the documentation at Motoko Programming Language :: Internet Computer every(most) code block in there already is such a playground. You can change them and press the Run button in the top-right to evaluate the code.

1 Like

Thanks I didn’t know that you can change the code.
Although this works, however I would recommend an improvement on this to be a stand alone page.

1 Like

I put together a playground couple days ago. Not much, just the doc snippet moved to a standalone page.

https://hackape.github.io/motoko-playground/

6 Likes

Word of warning though. The playground supports both more features (eg. recursive actor classes) and fewer features (eg. cycle transfer, state rollback on trap) than code that is compiled to run on the internet computer. This is because it’s a simple interpreter designed to exercise some but not all of language design.

But thanks for doings this!

4 Likes

How feasible is it to compile moc to Wasm so we can have an on-chain compiler? What about to JS so we can build web IDEs?

1 Like

OCaml to Wasm support is not great. But we do have a JS version of moc, and will have a web IDE coming up in a few weeks :slight_smile:

8 Likes

Thanks to @hackape I have also deployed his work on the ic
check this out
https://bgtba-gyaaa-aaaad-qagya-cai.ic.fleek.co/

1 Like

This would be nice to have on canlista!

https://k7gat-daaaa-aaaae-qaahq-cai.ic0.app/

How do I add it to canlista?
Edit: found it

1 Like