lua-users home
lua-l archive

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

* On 2010-11-18 Wesley Smith <> wrote  :

> I too found LPEG mysterious at first.  It took a lot of playing around
> with it before it really made sense.  The thing that confused me the
> most was the V grammar rule function, but in the end I was over
> thinking it.  For someone who is not familiar with PEG and string
> matching, the terminology looks really obscure.  What I would suggest
> is trying some really simple patterns without going in to grammars
> until you feel more comfortable with LPEG.  Try something dead simple
> like matching patterns with 1 character, then 2 characters, then
> generating a search in a larger string for those patterns.  I think
> this will help give you a taste of what LPEG is all about.

For what it's worth, my two cents. I totaly agree with this: It is very
possible to 'grow' a grammar by incrementally adding small pieces and
learning on the fly, testing the results every run to see what exactly
is going on. I had some troubles understanding a lot of  details of the
LPEG grammar at first as well, but I was able to build a complete SIP
parser in a two or three days from the ground up, with no previous LPEG
experience at all.