Re:List of languages that compile to JS
by amadiver on Thursday January 06, 2011 @09:56AM
(#2075492)
Any tools that work in the opposite direction? ( e.g., JS -> C )
[ Parent
| on HN ]
Red Daly has a JavaScript to Parenscript (Common Lisp) translator: https://github.com/gonzojive/js-to-parenscript
The generated code from that won't run without a JS runtime implementation in CL backing the JS-specific Parenscript forms, which currently doesn't exist to my knowledge (it's not hard to write, just not very useful). This is useful by itself for writing JS analysis and transformation tools and moving JS code to Lisp.
There's CL-JavaScript: http://marijnhaverbeke.nl/cl-javascript/
This is a translator/compiler/"simulator" (http://www.cs.aau.dk/~normark/oo-scheme.html) that provides good integration between the two languages.
Rhino does JS -> Java bytecode internally but I don't think you can grab those classes and execute them outside Rhino.
A full compiler would of course always have the problem of dynamically generated JS, i.e eval().