lua-users home
lua-l archive

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

Andy Stark wrote:
Would it be feasible/desirable for a future version of Lua to use PEG
techniques (coded in C) in its own parser?
What advantage would that bring? The Lua parser works already, right? Unless,

If LPEG was distributed as a standard library, then would it be possible
for Lua's parser to be written in Lua, perhaps with a few extra library
There would certainly be some bootstrapping problems since LPeg uses Lua operators to compose patterns :). I know of a language which bootstraps itself with some minimal operators but I can't seem to find it right now. I think it was hosted on A different approach would be to write the Lua parser in LPeg via the Lua C API, then you could hook in your own patterns (written in Lua) without problems. But these patterns would extend the syntax, not change it. Otherwise you wouldn't be able to, for example, parse [[ long string ]] because those need a callback function, which needs to be written in Lua...

Though I must admit I've always been fascinated by bootstrapping systems like compilers and parsers :)