I have some legacy code, which uses Lisp as it’s scripting language. To broaden, ease and accelerate scripting I’d like to replace Lisp by Javascript.
In order to be able to built on all present scripting files, I first need to translate all lsp
to js
.
Now I found parenscript but am not yet sure what it is good for (seems to modify Javascript to be able to run lisp, which is not what I want).
Also there are some converters on the web, which seem to work quite well.
Has anyone already done this and can share some experiences, best pracises and tools?
8
Common Lisp is huge, and writing a compatible compiler / runtime is out of question for a novice. Parenscript is probably your best bet for direct running of your Lisp code on a JS target.
For simpler versions, like Scheme, there’s a ready-made interpreter.
If you understand basic Lisp, take also at look a Clojure, a Lisp variant. Chances are you might port significant chunks of Lisp code to Clojure without a major rewrite. Then apply their JS compiler and see if it works for you.
JavaScript has quite Lispy internals (despite the bolted-on OOP features), so efficient translation of moderate amounts of simple Lisp code (e.g. without macros) to JS is not impossible to do by hand.
The bottom line is: there’s no silver bullet. You’d better learn some Lisp to handle your task. (Try it; it’s well worth it, and also forever changes the way you see programming.)
1