lua-users home
lua-l archive

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

steve donovan <> writes:
> I'm a fan of the simplest solution to do the job. Why use lpeg if
> plain Lua does the job, in a way that anybody can understand? Just
> because it is possible to use lpeg, does not mean that it is the
> appropriate solution.  Remember that a robust solution would need
> proper error handling, which takes special care in lpeg.

I didn't look at your code, but my general observation, from
implementing various parsers both in Lua and in Lua+LPeg, is that the
"LPeg solution" is usually shorter, much easier to write and
understand, more precise[1], and a lot faster.

[1] I've found that often it's very tempting to take little "not a big
deal" shortcuts in the Lua parser to make the job easier or make the
parser faster, but in LPeg it's typically quite easy to implement the
_exact_ grammar, with little or no speed penalty.

Dunno what you mean about error handling, it seems pretty much the
same in LPeg as in a hand-written parser (LPeg kinda acts like a very
concise way of writing a recursive descent parser, after all).


Philosophy, n. A route of many roads leading from nowhere to nothing.