<div dir="ltr"><div>Free books here:</div><div><a href="http://stephane.ducasse.free.fr/FreeBooks.html">http://stephane.ducasse.free.fr/FreeBooks.html</a></div><div> </div><div>Early Squeak was pretty similar to the description in</div><div> </div><div><a href="http://sdmeta.gforge.inria.fr/FreeBooks/BlueBook/">http://sdmeta.gforge.inria.fr/FreeBooks/BlueBook/</a></div><div> </div><div> </div><div>Karl</div><div> </div><div> </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 20, 2014 at 12:01 PM, Casey Ransberger <span dir="ltr">&lt;<a href="mailto:casey.obrien.r@gmail.com" target="_blank">casey.obrien.r@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
I don&#39;t know anything about how the Squeak decompiler works.<br>
<br>
One approach to translating code in one language to another is to build a parser for the source language in order to obtain an abstract syntax tree (AST) and then use a pretty-printer for the target language on the AST. That&#39;s the short, short version of an explanation of how we translate the Squeak VM from Slang to C.<br>
<br>
In the case of a decompiler for a byte compiled system, the source language (using the above approach) would be the bytecodes themselves, and the target language could be any language with sufficient facilities to support the semantics of the source language (in the case of a decompiler, the target language would be the original language used to compile the e.g. bytecode.)<br>
<br>
I hesitated to respond, because I definitely don&#39;t know anything about Squeak&#39;s decompiler, and also because what I&#39;ve described is in some ways a massive oversimplification (if the compiler is optimizing things, deoptimization may be necessary to approach the intent and style of the original programmer&#39;s code, and that&#39;s just one thing I can think of.)<br>
<br>
We have available to us a couple of tools which make it (relatively) easy to play around with this idea and get a feel for it (OMeta/Squeak and PetitParser.)<br>
<br>
I&#39;d recommend checking out PetitParser if you&#39;re messing with stuff to do with compilation, as OMeta&#39;s development seems to mostly have shifted to Javascript. PetitParser is actively maintained.<br>
<br>
Decompilation hasn&#39;t been an area of interest for me, and I don&#39;t know much about it, so I may be sending you down the primrose path. In the immortal words of LeVar Burton, &quot;don&#39;t take my word for it.&quot;<br>
<br>
I know that several research papers have been written about OMeta, and I&#39;d bet some have been written about PetitParser as well. The focus of these systems is on parsing expression grammars (PEGs,) but language to language translation is a thing, and it seems to me that a decompiler can be viewed as a special case of this thing. Following the references cited in such papers could prove valuable to whatever your cause is.<br>
<br>
For historical perspective on OMeta and PetitParser, it might be helpful looking into the meta language called Meta-2.<br>
<br>
Arguably, this question would be as well addressed on squeak-dev, as both the compiler and the decompiler are image-residents, and not built into the VM (though both are tied to the VM&#39;s behavior wrt interpreting bytecode.)<br>
<br>
HTH, sorry if it doesn&#39;t.<br>
<span class="HOEnZb"><font color="#888888"><br>
Casey<br>
</font></span><br>
P.S.<br>
<br>
People who actually know how Squeak&#39;s decompiler works should still probably chime in here :D<br>
<div class="HOEnZb"><div class="h5"><br>
&gt; On Oct 20, 2014, at 1:51 AM, Whiter Walt &lt;<a href="mailto:whiter.walt@gmail.com">whiter.walt@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; I am interested in the Squeak Decompiler class. Is there any technical information in the net, which explains the functionality? Or maybe it follows some common &quot;rules&quot;, I can find in some paper or book?<br>
&gt;<br>
&gt; cheers<br>
&gt; Walt<br>
</div></div></blockquote></div><br></div>