Luke Palmer wrote:
Edward Peschko writes:
Ok, fair enough.. although I'm not sure that I'm all that sure I'm completely
happy-with/understand the syntax described in that article. It works for the trivial cases, but what about complex grammars?
It works for anything. It gets pretty inefficient in the case of code
assertions, but there's no way around that. Testing your assertions
isn't going to be the useful thing about this, anyway.
Eyeballing and fixing the regular expression then becomes trivial (or relatively trivial).
I definitely see the use.
You just pass it to generate. It recursively calls itself until it's down to constant strings, which are always a well-defined match (or character classes, which are tricky and computationally intractible in the presence of unicode).
I love programming in theoretical Perl 6.
Luke
Now this is truly useful. Especially when one realizes that all of Perl 6 is already expressed in these handy regular expressions.
It's therefore possible to generate all possible Perl 6 programs, then simply see which one(s) satisfy your test cases, and there's no need to do any silly programming ever again!
And just think... All the p6c group has to do is a little prep work, and P6 will then write itself! Just think of the marketing ploy: "Other languages were written _in_ themselves. Perl was written _by_ itself."
This solution definitely has Laziness and Hubris going for it, though I suspect it may be lacking in the Impatience department.
(I need more sleep) -- Rod Adams