开源软件名称(OpenSource Name):wizzard0/js2lua开源软件地址(OpenSource Url):https://github.com/wizzard0/js2lua开源编程语言(OpenSource Language):JavaScript 96.1%开源软件介绍(OpenSource Introduction):Javascript to Lua translatorHey, I heard Javascript was made in 10 days!So... this is an experiment with making a full-blown Javascript to Lua translator, preserving semantics and so on. It's a single-pass transpiler that directly generates Lua code from the Esprima AST, without any kind of IR. Quick-and-dirty, cutting corners, etc etc - don't expect much of this code :) For example, each ternary expression (?:) generates 4 function calls and a closure - too lazy to implement anything more clever :) Runs on vanilla LuaJIT, without any C modules or hacking the VM (e.g. Tessel runs on Lua, too, but on heavily modified runtime, which I didnt like) Oh, and it probably can't bootstrap itself right now. Anyone willing to make it self-hosting? That would be cool :) Results on ES5 test suite in 10 days:
UPDATE: For more complete variants, see https://github.com/PaulBernier/castl. Also, https://github.com/Etiene/js2lua Requirements and usageUses LuaJIT, esprima, lua-date, lpeglj, ta-regex, ast-hoist, esutils, escodegen Tested under LuaJIT 2.1+ and node 0.10+. Assumes LuaJIT binary at To run something: To run tests: To run entire ES5 test suite: License: MIT (c) 2015 Oleksandr Nikitin oleksandr@tvori.info |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论