[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Simple peg examples
- From: steve donovan <steve.j.donovan@...>
- Date: Tue, 12 Jun 2012 14:15:05 +0200
On Tue, Jun 12, 2012 at 1:59 PM, Gavin Wraith <gavin@wra1th.plus.com> wrote:
> It is cool. It is not as widely applicable as Peter Shook's original
> patch, being only useable after the keyword 'local'. However, it does
> encourage the use of local variables and I find it very convenient.
Which is precisely why it's one of the few syntax tweaks I would
whole-heartedly +1.
> On the topic of lpeg I am full of admiration and frustration.
I've resisted for years but now realize that it is a most amazing
piece of technology. I was prompted to write a tutorial because I
hoped that I could record my learning experience in a way that others
might find useful.
> Conflating patterns with strings has been a
> big source of unreadability and exploding escape-sequences.
Absolutely - no more 'magic' is a point that you do make. Being able
to _compose_ patterns makes it possible to approach string pattern
matching as a programmer, not as a cut 'n paste activity.
It's a new language. The tutorial aims to introduce the vocabulary in
a more gentle fashion, in a very interactive way. I still remember my
headaches with regular expressions and even Lua string patterns, and
then the light dawned. But non-trivial regular expressions still make
my head hurt to read.
Still not entirely sure how to write about grammars without scaring
the children!
steve d.