franko / luajit-lang-toolkit

A Lua bytecode compiler written in Lua itself for didactic purposes or for new language implementations
Other
652 stars 91 forks source link

Luacode generation fixes #24

Closed gnois closed 9 years ago

gnois commented 9 years ago

Hi,

I encountered some issues when trying out the Lua code generator, and went ahead to fix them. Please review if they are appropriate. Thanks.

franko commented 9 years ago

Hi,

this is good job! Thank you very much for these contributions. I've published in the branch

https://github.com/franko/luajit-lang-toolkit/tree/gnois-luacode-gen

you changes together with some fixes. The most important issue was with the "keyvals" attribute for literal tables. Your changes make a lot of sense but as you changed the node public attributes they broken the bytecode generator!

I've also added a test suite for the lua code generator backend

https://github.com/franko/luajit-lang-toolkit/blob/gnois-luacode-gen/scripts/test-luacode-output.py

I have 5 tests fails but I think they are not due to your changes. In the past I didn't test a lot the lua code generator and most of the attention went to the bytecode generator.

May be you can give a look at the changes I made so that you may comment on them. If everything is ok I will merge you pull requests and my further fixes.

gnois commented 9 years ago

The last minor change fixes the not-operator-* test cases failure.

gnois commented 9 years ago

Definitely! My changes in b57aa2d looks more like a hack now. :) I rolled back them and committed yours. Thank you.