LiveDemo: http://basicer.com/lua2js/

NPM Package: https://www.npmjs.org/package/lua2js

Repository: http://github.com/basicer/lua2js/


Some features I think make my parser special

  • Runs many lua programs off the shelf with identical output to stock interpreter
  • Operators replaced with function calls to maintain correct lua behavior.
  • Lots of blood, sweat and tears to support language features like tuple unpacking and ... arguments.
  • Tunable parser options to enable and disable different AST transforms to support trade-offs between correct lua behavior and cleaner javascript output.
  • Many features (loops, calls, operators) detect javascript vs lua objects and at accordingly. (Fix the value of this, round trip lua tables as arrays when passed to JS functions, etc..)
  • Custom error messages for common mistakes, such as forgetting an end, not closing "'s etc.
  • Above error messages mention the beginning of the block they are referring to.
  • Parser grammar written from scratch using PEG.js instead of porting existing JS parser.
  • Loose parsing mode with support for multiple error messages and running half working programs.
  • No runtime NPM dependencies, all runtime code MIT (or some other license if you prefer!)

Special Thanks

  • Vicky Chijwani: For braving the elements and making the first Aether integration.
  • Matt Lott: For help finding bugs and writing the python unit tests in Aether the Lua ones are based on.
  • Nick Winter: For answering way too many of Aether related question.
  • #love@irc.oftc.net: For awesome use of the Lua language and breaking things in my parser.

Built With

Share this project:
×

Updates