Mini Pharo -> JavaScript translator?
Hi! Is there a simple way to translate Pharo code into Javascript? There is Pharo JS, but I cannot load it in Pharo 6. There is the amber compiler, but I cannot find a version for Pharo. Amber takes the approach of translating everything into JavaScript, including the Smalltalk object model. While this is great for fan of bootstrapping images, it produces large javascript code. Is there a kind of Slang for JavaScript? I am looking for something minimal. Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On 3/10/17, Alexandre Bergel <alexandre.bergel@me.com> wrote:
Hi!
Is there a simple way to translate Pharo code into Javascript? There is Pharo JS, but I cannot load it in Pharo 6. There is the amber compiler, but I cannot find a version for Pharo.
Amber takes the approach of translating everything into JavaScript, including the Smalltalk object model. While this is great for fan of bootstrapping images, it produces large javascript code.
Is there a kind of Slang for JavaScript? I am looking for something minimal.
Cheers, Alexandre
Hello Alexandre Something like this https://github.com/ympbyc/LittleSmallscript or http://wiki.squeak.org/squeak/5860 which refers to http://www.squeaksource.com/@xxu3r2Ma7SbqJi3E/1j-SgMCf (74000 downloads). People have used it successfully. There is probably a Pharo port. --Hannes
On Sat, Mar 11, 2017 at 1:16 PM, H. Hirzel <hannes.hirzel@gmail.com> wrote:
http://www.squeaksource.com/@xxu3r2Ma7SbqJi3E/1j-SgMCf (74000 downloads).
Hi Hannes, That link doesn't work. You need to pick the html one under "Links" heading half way down the project page. cheers -ben
A potential solution would be Pharo -> Slang -> C -> Javascript Slang converts pharo code to C and Emacscripten converts C to Javascript. This approach also should produce minimal JS code but it wont be readable. This C to Js approach also has the advantage of being able to utilize webassembly and asm.js to provide high performance JS code something that other approaches that go directly from Pharo to JS will struggle with. The reason being that tools that support these approaches tend to more heavily optimize the generated JS code. The catch here is that you will have to understand both C and JS to iron out potential issues. So this means this is definitely not a "simple way to translate Pharo code into JS" as you requested.
participants (4)
-
Alexandre Bergel -
Ben Coman -
Dimitris Chloupis -
H. Hirzel