viebel / klipse

Klipse is a JavaScript plugin for embedding interactive code snippets in tech blogs.
http://blog.klipse.tech/
GNU General Public License v3.0
3.11k stars 148 forks source link

oCaml support for klipse #148

Closed dvberkel closed 4 years ago

dvberkel commented 7 years ago

With this issue I would like to gauge the interest to support oCaml in klipse.

BuckleScript is an excellent oCaml to JavaScript compiler, that also runs in the browser.

If there is interest, I am willing and hopefully able to provide a pull request integrating oCaml in klipse

viebel commented 7 years ago

That's exciting. I'm very very interested by being able to evaluate oCaml in klipse. Then we would be able to write an interactive version of the article behind core.match.

dvberkel commented 7 years ago

Great!

I will take some time to familiarize myself with BuckleScript and then try to include it in klipse.

viebel commented 7 years ago

You can take a look at how it is done for ruby in this file https://github.com/viebel/klipse/blob/master/src/klipse/lang/ruby.cljs or python here https://github.com/viebel/klipse/blob/master/src/klipse/lang/python.cljs

On Tue, 6 Dec 2016 at 12:56 Daan van Berkel notifications@github.com wrote:

Great!

I will take some time to familiarize myself with BuckleScript and then try to include it in klipse.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/viebel/klipse/issues/148#issuecomment-265120825, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6VPuL611APC9CeWD7LkMYLbVra9Kdtks5rFT9kgaJpZM4LFQqJ .

dvberkel commented 7 years ago

As detailed by @bobzhang in ocsigen/js_of_ocaml/#528, the BuckleScript playground compiles and evaluates oCaml as expanded upon in bloomberg/bucklescript#629. At the moment there is no public exposed API as can be seen bloomberg/bucklscript#125.

Building upon these thoughts, a prototype of what we want can be seen is at jsbin. At the moment it only compiles the oCaml code. The JavaScript is not evaluated.

I will keep working on it until I have a single full round trip.

viebel commented 7 years ago

@dvberkel The prototype in jsbin doesn't work for me because files hosted on github ares served as text file. You have to host the file in another place.

dvberkel commented 7 years ago

@viebel I can't seem to loose the failing demos ;-)

I will keep working on it and convert the prototype to something that I have more control over.

viebel commented 7 years ago

@dvberkel any progress/blockers? Do you need help?

dvberkel commented 7 years ago

I have made a (hopefully) working prototype.

The only problem that I have is doing to many things at once :-). I will probably work on integrating this with klipse tomorrow. If I get stuck, I will start asking questions.

viebel commented 7 years ago

Very nice! It should be straitforward to add ocaml into klipse. Look for instance at JSX integration into klipse and grep for klipse.lang.jsx

viebel commented 7 years ago

I've create a first draft wiki page for instructions about how to add a new language in klipse https://github.com/viebel/klipse/wiki/How-to-add-a-language-to-klipse