franko / luajit-lang-toolkit

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

Document for AST format? #16

Closed larme closed 9 years ago

larme commented 9 years ago

Hi,

I wonder how this project's AST format differs from metalua's (described here). I'm considering port a project's backend from metalua to it. Thanks!

franko commented 9 years ago

Hi,

sorry for giving an answer only now, I didn't notice your message.

Actually the AST of the language toolkit is undocumented and differs from metalua format in many ways. For the moment I don't have any project of changing the AST format neither to add documentation even if I recognize that a formal document could be useful.

From the practical point of view the AST is sort-of documented in the file

https://github.com/franko/luajit-lang-toolkit/blob/master/lang/ast-validate.lua

that describe each node of the AST and all the attributes of each node and their expected types.

Not sure if this helps but this is the current status.

larme commented 9 years ago

Thanks for the answer. After some quick review I think essentially your ast model and metalua's are the same (because both are from the official lua syntax definition?), just in different format.