{"id":127,"date":"2005-03-14T21:32:58","date_gmt":"2005-03-14T19:32:58","guid":{"rendered":"http:\/\/blogs.bl0rg.net\/netzstaub\/?p=127"},"modified":"2005-03-14T21:32:58","modified_gmt":"2005-03-14T19:32:58","slug":"parenscript","status":"publish","type":"post","link":"https:\/\/blogs.bl0rg.net\/netzstaub\/2005\/03\/14\/parenscript\/","title":{"rendered":"ParenScript"},"content":{"rendered":"<p>I actually have a lot of real work to do, so I had to quit my &#8220;opensource-programming&#8221; procrastination as fast as possible. That&#8217;s why I rushed the release of my Lisp to Javascript &#8220;compiler&#8221; ParenScript. Compiler is actually a very big word, as ParenScript doesn&#8217;t do much more than correctly indent a Lisp expression representing Javascript code (it does a few optimization on the way, though). I had at first written a very hackish implementation of the compiler, with an undefinite intermediary representation somehow consisting of strings and lists of strings. After I got the mess working, I decided to rewrite the compiler in a clean way. ParenScript in the version 0.1.0 actually is a lot cleaner, a few people may even understand its inner workings, but there still is a lot to do. It has been given next to none testing in a real setup. The indentation is a bit weird sometimes, and could be given a lift up. The error handling is very minimal.<\/p>\n<p>However, as rushed as I was to release ParenScript, I put the whole day into its manual, and I think it has turned out to be quite nice. Here is the <a href=\"http:\/\/bknr.net\/parenscript\">ParenScript webpage<\/a>, the <a href=\"http:\/\/bknr.net\/adm\/parenscript_0.1.0.tar.gz\">software<\/a>, the <a href=\"http:\/\/bknr.net\/adm\/parenscript-manual.pdf\">manual<\/a> and the <a href=\"http:\/\/bknr.net\/adm\/parenscript-reference.pdf\">language reference<\/a>. ParenScript it also installable using ASDF-INSTALL, just type<\/p>\n<pre>(asdf-install:install 'parenscript)<\/pre>\n<p> and it should install fine.<\/p>\n<p>To give you a little idea of what ParenScript does, here is a ParenScript program and the generated JavaScript:<\/p>\n<pre>\n(defun apply-effect () \n   (when (and document.all photoslider.filters) \n      (let ((trans photoslider.filters.reveal-trans)) \n          (setf (slot-value trans &#8217;*Transition) \n                (floor (* (random) 23))) \n          (trans.stop) \n          (trans.apply))))\n<\/pre>\n<p>The generated JavaScript code looks like this:<\/p>\n<pre>\nfunction applyEffect() { \n   if (document.all &#38;&amp; photoslider.filters) { \n      var trans = photoslider.filters.revealTrans; \n      trans.Transition = Math.floor(Math.random() * 23); \n      trans.stop(); \n      trans.apply(); \n   } \n} \n<\/pre>\n<p>From the feature list:<\/p>\n<ul>\n<li>Supports all the expressions and statements of EcmaScript 262<\/li>\n<li>Converts Lisp symbols to java-style camelcase (taken from linj)<\/li>\n<li>Lisp-style iteration with DO, DOTIMES, DOEACH, DOLIST<\/li>\n<li>Complete macro environment with MACROLET, SYMBOL-MACROLET<\/li>\n<li>Uses the Lisp reader for reader macros<\/li>\n<li>ParenScript HTML generator for embedding HTML in JavaScript code (not more ugly document.writes)<\/li>\n<li>Allows for recursive compilation of ParenScript (generate Javascript in Javascript in Javascript&#8230;)<\/li>\n<li>Lispy CSS syntax<\/li>\n<\/ul>\n<p>UPDATE: I&#8217;ve blogged about the javascript compiler before. In english here: <a href=\"http:\/\/blogs.bl0rg.net\/netzstaub\/archives\/000512.html\">javascript experiences<\/a>, and in german here: <a href=\"http:\/\/blogs.bl0rg.net\/netzstaub\/archives\/000504.html\">lisp to CSS<\/a>, <a href=\"http:\/\/blogs.bl0rg.net\/netzstaub\/archives\/000467.html\">javascript, so eine geile sprache<\/a>, <a href=\"http:\/\/blogs.bl0rg.net\/netzstaub\/archives\/000462.html\">javascript expressions<\/a> , <a href=\"http:\/\/blogs.bl0rg.net\/netzstaub\/archives\/000461.html\">javascript compiler<\/a> and <a href=\"http:\/\/blogs.bl0rg.net\/netzstaub\/archives\/000447.html\">lisp to javascript<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I actually have a lot of real work to do, so I had to quit my &#8220;opensource-programming&#8221; procrastination as fast as possible. That&#8217;s why I rushed the release of my Lisp to Javascript &#8220;compiler&#8221; ParenScript. Compiler is actually a very &hellip; <a href=\"https:\/\/blogs.bl0rg.net\/netzstaub\/2005\/03\/14\/parenscript\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,3],"tags":[],"class_list":["post-127","post","type-post","status-publish","format-standard","hentry","category-english","category-lispstaub"],"_links":{"self":[{"href":"https:\/\/blogs.bl0rg.net\/netzstaub\/wp-json\/wp\/v2\/posts\/127","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.bl0rg.net\/netzstaub\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.bl0rg.net\/netzstaub\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.bl0rg.net\/netzstaub\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.bl0rg.net\/netzstaub\/wp-json\/wp\/v2\/comments?post=127"}],"version-history":[{"count":0,"href":"https:\/\/blogs.bl0rg.net\/netzstaub\/wp-json\/wp\/v2\/posts\/127\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.bl0rg.net\/netzstaub\/wp-json\/wp\/v2\/media?parent=127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.bl0rg.net\/netzstaub\/wp-json\/wp\/v2\/categories?post=127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.bl0rg.net\/netzstaub\/wp-json\/wp\/v2\/tags?post=127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}