lua-users home
lua-l archive

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


> > This suggests the need for a library to parse Lua programs into Lua data
> > structures (and vice-versa though not for this case). That way one could
> > write the Lua analysis tools in Lua.
> 
> ltokens might doen that(?)
> http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/

Yes, ltokens is a first step. I think it's important to reuse Lua's lexer
because it'll ensure consistency with what Lua does see.

It would be really nice to be able to reuse Lua's parser and get a parse
tree not just a stream of tokens. But I can't see how to do that. It does
not seem too hard to edit lparser.c and make it build a parse tree. But my
point is doing that *without* surgery.
--lhf