On 2009-Oct-7, at 5:18 pm, Aaron Sherman wrote:
This should be powerful enough to match any arbitrarily nested set of iterable objects. I think it will be particularly useful against parse trees (and similar structures such as XML/HTML DOMs) and scanner productions, though users will probably find nearly infinite uses for it, much like original regular expressions.
I agree that being able to parse data structure would be *extremely* useful. (I think I posted a suggestion like that at one time, though I didn't propose any syntax.) There is already a way to parse data -- Signatures, but not with the full power that grammars can apply to text.
Data-grammars could do everything that Signatures do, and more, though it's still worth having special syntax designed to fit the special and ubiquitous case of sub signatures. Trying to expand signature-syntax to cover everything grammars can do would probably end up too ugly; nevertheless, if we had full grammars to build on, I'm sure the Sig- syntax could be extended quite a lot before it got too cumbersome. It would also open the way for people to build custom sig-parsers (with their own special syntax or not).
It also might be worth inventing a whole new syntax design for parsing and manipulating data structures, but your suggested extensions seem pretty good to me.
-David