[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lpeg as a part of lua (was: An introduction to Lua)
- From: Gavin Wraith <gavin@...>
- Date: Sun, 22 Oct 2017 19:08:00 +0100
In message <CABcj=tnFooWJuyc2SpWsOHCf7Rp7exhf7UTDYri0Bk9WjVxfSw@mail.gmail.com>
Dirk Laurie <dirk.laurie@gmail.com> wrote:
> Put another way: the issue is not what can you do with LPeg, it is
> what can you do that you can't do with Lua patterns, and whether
> that extra is sufficiently common to justify adding LPeg to Lua.
That seems sensible to me. I have tried dipping my toe into Lpeg
but I have found it quite hard - particularly to incorporate
error handling. It reminded me of my superficial struggles with
Haskell. The abstractness of its approach is very appealing,
though. One cannot help feeling that there is something very
right and natural about it.
On a slightly different tack, what I would find useful is an
extension of the Lua string library to ropes, i.e. trees
whose leaves are strings. The implementation of strings in Lua
makes string comparison cheap and string manipulation
expensive. When results are written out to file, ropes have
an algorithmic advantage in this respect. A project for
somebody younger than me: to formulate good algorithms for
pattern matching and catching data in ropes?
--
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/