lua-users home
lua-l archive

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


On Mon, Sep 27, 2010 at 3:29 PM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> On Mon, Sep 27, 2010 at 8:10 AM, Miles Bader <miles@gnu.org> wrote:
>> "LPeg solution" is usually shorter, much easier to write and
>> understand, more precise[1], and a lot faster.
>
> Well, there has been a posted solution, which is pretty nifty, but I
> remain unconvinced.
>
> Perhaps because I'm not 'thinking' lpeg yet, but throwing a grammar at
> such a simple file format seems like overkill.  If one was living and
> breathing PEGs, then perhaps 'easier to write and understand' is a
> true statement.

Perhaps you're right -- LPeg is not always the right choice, even if
it's often a good one -- but often even "simple" formats are more
complex than they might appear at first, and the handling of the picky
details can run afoul of Lua weaknesses like efficient low-level
(character-level) string handling (which then leads to taking
shortcuts, and ...).

[I did look at some net description of the init format earlier in this
thread, and it does have the usual bunch of little corners ...
escapes, quoting, yadayada.  Of course they make the LPeg parser more
complex too.]

-Miles

-- 
Cat is power.  Cat is peace.