if translate js to lua opcodes, that should be easy.
i have written a js interperter last year(ecma-262 percisely), compiling script to mechine code is not that hard as you though(hard part is optimizing)
translating means script to script translate, that is not easy
continue LABEL, or break LABEL
发件人: agentzh <firstname.lastname@example.org>
发送时间: 2011-11-21 13:48
收件人: Lua mailing list <email@example.com>
On Fri, Nov 18, 2011 at 11:14 PM, Axel Kittenberger <firstname.lastname@example.org> wrote:
> JS to Lua is just as tricky. As similar the languages have evolved
> (convergent evolution) they are different enough that they cannot be
> easily translated in each other, at least not without a large
> compatibility/emulation layer.
I don't think it'll trickier than translating Perl 5 to Perl 6 ;)
> In Lua 5.1 I would have said,
> impossible since continue not supported by Lua, with 5.2 they got a
> workaround at least. Its still tricky tough.
Why should we do a strict literal translation here? The assembly
language does not support "continue" but it does not prevent a C
compiler to translate C code to it ;)
> How do you properly
> emulate JS undefined/null destinction?
Userdata, for example? ;)
> On Arrays with holes one can
> construct cases where JS even distinguishes "not there", "undefined"
> and "null" :-)
compiler implementation :)
test suites out there ;)