|
Peter Odding wrote: > As a test for myself and LPeg I wrote a > lexer/tokenizer[1] based on the BNF at lua.org/manual/5.1 and a syntax > highlighter[2] to try it out. Good school exercise... Very fine example, and useful too. 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? 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 functions)?
Same reaction as Peter, what for? The current lexer will be probably always faster than an LPeg implementation (as it is hand-written), and is able to handle subtle corner cases of syntax... On the other hand, I suppose it would delight people wanting to customize Lua syntax... :-)
One can rewrite at least luac this way (direct bytecode generation). -- Philippe Lhoste -- (near) Paris -- France -- http://Phi.Lho.free.fr -- -- -- -- -- -- -- -- -- -- -- -- -- --