lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Javier Guerra Giraldez wrote:
On Saturday 29 November 2008, Fabien wrote:
I've just written and put online an AST --> Lua source converter. While it
doesn't translate into a different target language, it shows how to
systematically walk through an AST, to produce a different representation
of it. This makes it a decent starting point for a Lua --> anything-else
converter, although it wasn't its original purpose

[snip]
still, having the AST easily readable is a big first step towards a Lua -->anything-else compiler.

Apart from an AST, I think one other critical piece of infrastructure is the symbol management stuff. It's pretty much a requirement for any serious work on locals/upvalues and globals, as I found when doing optimization of local names in LuaSrcDiet. The other allocated stuff are the constants and prototypes, which is more straightforward. Activation (or visibility) time of local variables is pretty critical.

Once the facilities are in place, Lua's use of tables makes development pretty convenient. Assuming no memory pressure, cross-references are dead easy to make, lookups are dead easy, tables are native... and manipulating all those grammar bits and stuff becomes pretty convenient. At the very least, it would be an amazing prototyping platform.

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia