lua-users home
lua-l archive

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


On Thu, Nov 13, 2008 at 9:28 PM, Javier Guerra wrote:
On Thu, Nov 13, 2008 at 3:21 PM, Fabien wrote:
> Actually, if you plan to write a translator that converges toward full Lua
> support, some architectural choices made by Vlad would be seriously
> unoptimal, although they made sense in his case.

that would be a really amazing project, i guess it would amount to a
full compiler.

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

http://repo.or.cz/w/metalua.git?a=blob;f=src/samples/synth.mlua

Beware, there's a bit of metalua-specific code in it: reintroduction of the syntax sugar (discarded from the AST) is mostly done with structural pattern matching.

For the record, this program is a preliminary hack for some more serious Lua refactoring libraries.

-- Fabien.