lantiga / ki

lisp + mori, sweet.js
ki-lang.org
MIT License
478 stars 28 forks source link

Enable ki in the browser #9

Closed lantiga closed 10 years ago

lantiga commented 10 years ago

This is useful e.g. for a live ki demo on ki-lang.org

See here: http://sweetjs.org/doc/main/sweet.html https://github.com/mozilla/sweet.js/blob/3062bde9d3464adee868c98a2ced44d2316a6763/browser/editor.html https://github.com/mozilla/sweet.js/blob/3062bde9d3464adee868c98a2ced44d2316a6763/browser/scripts/editor.js

lantiga commented 10 years ago

Done, it works as of https://github.com/lantiga/ki/commit/896690a5d7814aaedac5d7c9520d79e425a5a6e1 Now look at the sweet.js editor and adapt it for ki.

johnjelinek commented 10 years ago

Will there be a distributable browser script available after this is closed? I'd like to embed ki into a blog post and show off some features without the build step.

lantiga commented 10 years ago

You can take a look at the editor directory in master, which is the code for the live editor I just released. Basically you'll have to ship the whole editor/scripts directory and invoke the ki compiler as done in editor.js.

I'm not sure whether we can wrap everything up in one script, it depends on how things stand with sweet.js. I'll investigate.

(Looking forward to your blog post, BTW)

johnjelinek commented 10 years ago

:+1:

johnjelinek commented 10 years ago

Have you seen this?http://jlongster.com/Compiling-JSX-with-Sweet.js-using-Readtables

It seems like they were trying to resolve the same problem.

lantiga commented 10 years ago

I've seen the post, in fact both ki and react.hiccup are operating in that space. In relation to mori, what the blog proposes is literals for constructing mori data structures rather than making it idiomatic to work with them.

I think ki could benefit from custom pattern classes and readtables, with reference to #10 and #7, both for handling syntax (instead of manually manipulating the AST) and for better error messages.