[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Overloading and extending operators, (l)PEGs and grammars
- From: roberto@... (Roberto Ierusalimschy)
- Date: Wed, 11 Apr 2007 14:42:19 -0300
> I have mixed feelings about (ab)using operator overloading to support inline
> expression of grammars. I can see the appeal to somehow add grammars as
> elements of the language, rather than strings, but strings aren't so hard to
> use, and are fairly flexible. I wonder if it wouldn't be better to use lpeg to
> write something like:
>
> equalcount = lpeg.grammar[[
> S = "0" B
> / "1" A
> / ""
> A = "0" S
> / "1" A A
> B = "1" S
> / "0" B B
> ]]
This seems exactly what the 're' module does (except that it cannot
handle complete grammars yet...).
-- Roberto