[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lexer and syntax highlighter powered by LPeg
- From: Philippe Lhoste <PhiLho@...>
- Date: Fri, 06 Apr 2007 14:17:30 +0200
Peter Odding wrote:
> As a test for myself and LPeg I wrote a
> lexer/tokenizer based on the BNF at lua.org/manual/5.1 and a syntax
> highlighter 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).
-- (near) Paris -- France
-- -- -- -- -- -- -- -- -- -- -- -- -- --