PaulBernier / castl

JavaScript to Lua compiler with runtime library.
GNU Lesser General Public License v3.0
372 stars 33 forks source link

Bootstrapping? #25

Closed chorman0773 closed 5 years ago

chorman0773 commented 5 years ago

I was looking for a library which would assist in creating an embedded javascript environment in the Minecraft Mod ComputerCraft (in particular, its derivative, CC:Tweaked), which executes programs written in lua. This library is almost perfect, though I cannot find a way to bootstrap it into pure lua. Would it be possible to create a small bootstrap program that basically runs this through itself, once to go to lua, once to check that it still works, and once again to confirm that the results are reproduceable, and the result being the final version (the one which was compiled to confirm reporduceability). Alternatively, I don't particularily need an automated method of doing so, if it is already possible to have the compiler compile itself in some way.

PaulBernier commented 5 years ago

Actually castl already compiled itself and it can be found here (together with the dependency on esprima also compiled to lua): https://github.com/PaulBernier/castl/tree/master/lua/castl/jscompile

Castl itself is already quite experimental, so castl compiled by castl, I really don't guarantee the outcome :)

chorman0773 commented 5 years ago

Ah thanks.

chorman0773 commented 5 years ago

To be fair, not guaranteeing the outcome though is the reason for 3 passes, as I described in the original post.