<div><div class="gmail_quote">On Mon, Apr 19, 2010 at 11:03 AM, Vladimir Sedach <span dir="ltr"><<a href="mailto:vsedach@gmail.com">vsedach@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
This work was removing the last of the old-style hacks from the<br>
compiler to clearly separate PS into three parts: the compiler itself,<br>
the special forms code, and the printer. This reduces code size and<br>
dependencies significantly, but the ultimate goal (which has mostly<br>
been achieved) is to provide an intermediary S-exp representation of<br>
JavaScript code that is directly and efficiently executable as Common<br>
Lisp code.</blockquote><div><br></div><div>What is the motivation for using lists as the intermediate form rather than CLOS objects? I suppose that s-expressions makes it easy to use tree-walking functions out of the box, but there seem to be disadvantages when it comes to separating syntax from semantics, e.g. addressing the 'else' form of an if via (third if-statement) vs. (if-statement-else if-statement).</div>
<div><br></div><div>I have not seen the intermediary form and I am sure you have good reasons, but it is not the direction I would have gone. Could you explain the choice perhaps with some motivating examples, to enlighten us all?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
In the future I'll be moving the printer code to a separate project,<br>
which will also have a parser from JavaScript to this intermediary<br>
representation. That project will serve as a useful base for JS code<br>
transformation tools, and I am planning to write a JS->CL compiler on<br>
top.<br></blockquote><div><br></div><div class="gmail_quote">Go, Vladimir, go! That's an ambitious project but I would love to see it happen!</div><div class="gmail_quote"><br></div>Please not that there is a project with a viable javascript parser and printer already. See <a href="http://github.com/gonzojive/js-parser">http://github.com/gonzojive/js-parser</a><div>
<br></div><div>I adapted the code from JWACS (Javascript With Advanced Continuations Support) into a new project for parsing javascript. The original JWACS included a pretty printer and an obfuscating printer that would obfuscate non-toplevel variables. It also had a Javascript-like grammar with a few extra syntax additions.</div>
<div><br></div><div>The syntax tree represents javascript with structures rather than lists for everything, but you should be able to avoid writing the parser yourself, at the very least.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
One user-visible change I made in the latest patches is to encourage<br>
use of CL equality predicates ('==' and '===' are still there but<br>
marked as deprecated). </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Vladimir<br>
<br></blockquote><div><br></div><div>Red</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
2010/4/19 John Pallister <<a href="mailto:john@synchromesh.com">john@synchromesh.com</a>>:<br>
<div><div></div><div class="h5">> +1, as they say...<br>
><br>
> ++Thanks,<br>
><br>
> John :^P<br>
><br>
> On Mon, Apr 19, 2010 at 12:42 AM, Daniel Gackle <<a href="mailto:danielgackle@gmail.com">danielgackle@gmail.com</a>> wrote:<br>
>> For those of us who are curious, could you talk a bit about the work you did<br>
>> on the compiler?<br>
>> Thanks Vladimir,<br>
>> Daniel<br>
><br>
> _______________________________________________<br>
> parenscript-devel mailing list<br>
> <a href="mailto:parenscript-devel@common-lisp.net">parenscript-devel@common-lisp.net</a><br>
> <a href="http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel" target="_blank">http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel</a><br>
><br>
<br>
_______________________________________________<br>
parenscript-devel mailing list<br>
<a href="mailto:parenscript-devel@common-lisp.net">parenscript-devel@common-lisp.net</a><br>
<a href="http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel" target="_blank">http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel</a><br>
</div></div></blockquote></div><br></div>