lua-users home
lua-l archive

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


On Apr 6, 2007, at 8:15 AM, Andy Stark wrote:

Well, as I understand it, PEGs allow you to specify both lexical and
syntactic patterns, so there wouldn't need to be a separate lexer and
scanner in the parser. I'm thinking a PEG system might make the code
easier to understand and modify. Maybe also smaller code size and speed
for the parser? Both are very important for Lua.

The memory use of a recursive descent parser is proportional to the nesting depth of the input, which for typical input is bounded by a small number, and because there's no backtracking the input string does not have to be retained in memory for speed.

It's pretty hard to beat a well-written recursive-descent parser in the efficiency department. A PEG-based parser would  use more memory and be quite a bit slower.

I love the simplicity and speed of the current Lua system. Not many systems compile a 2 megabyte source file in 1 second or so.


--
Gé Weijers