Show HN: Clojure parser and core library in JavaScript, live on CodeCombat
vickychijwani.github.io
vickychijwani.github.io
It's not a full compiler. It's a parser that plugs into http://aetherjs.com/, which transpiles the Clojure code to JavaScript and then executes it.
> Did you implement the whole Clojure.core?
Not all of clojure.core is implemented -- a list of what's implemented is available at http://vickychijwani.github.io/closer.js/spec_runner.html?sp....
> Good work!
Thanks :)
I'm looking forward to when they make the UI properly support it. They haven't changed much in the UI other than letting you type code in other languages. My issues:
1. When you change the language for the current level, it doesn't change the default code. You have to delete the Javascript by hand, including the comments.
2. New levels don't have the default code be other languages.
3. editor "Smart Behaviors" (in Editor Configuration) doesn't work in Clojure. When I type an opening parenthesis, there is no closing parenthesis automatically inserted.
4. The "available spells" are in JS. If I didn't already know that "this.moveRight();" in Javascript translated to "(.moveRight this)" in Clojure, I would've had no idea how to do anything.
5. Errors aren't especially useful. In Clojure, typing "(.attackNearbyEnemy)" results in "parse error: expecting IDENTIFIER, COLON, ANON_ARG..." Obviously, this is a hard problem, but I'd rather see something like "you called a one-argument function with zero args".
6. In Emacs keybindings, if point is at the a line with text in it, C-k doesn't delete the newline character, moving the next line to the end of the current one -- it does nothing.
These are all things I expect to be fixed soon. There's a lot of work to be done to add multi-language support, and it's awesome it's getting done.
[0] - http://us3.campaign-archive2.com/?u=c86c5e56e46659873417a8f1...
Your 'Nodes' file shows a strong familiarity with what's going on inside Coffeescript, too. :)
Thanks!
> There are a couple of other projects like this. Are you familiar with Wisp or Outlet?
The thing is, Closer was created for use on CodeCombat, which expects the parse tree to be in the standard Mozilla AST format [1]. As far as I know, none of the projects you mention satisfy this requirement.
> Your 'Nodes' file shows a strong familiarity with what's going on inside Coffeescript, too. :)
Actually it was lifted verbatim from [2] -- I just converted it to CoffeeScript :)
[1]: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Sp... [2]: https://github.com/zaach/reflect.js
I don't know anything about Outlet, but the Wisp compiler actually makes use of Escodegen [1] – which expects input to be provided in the Mozilla AST format – to generate JavaScript. You can peek at writer.wisp [2] in the compiler codebase to see how it's done.
[1] https://github.com/Constellation/escodegen [2] https://github.com/Gozala/wisp/blob/master/src/backend/escod...