in reply to Re: hypothetical variables
in thread hypothetical variables
I think Perl5 "comprehended" this with the qr// syntax. It's obvious in languages where rx is an ordinary function or class, since backslashes for literal strings are totally independant from metacharacters seen by the function.
Having callable subrules as predicates is something I've waited a long time for. That was the natural idea for me in the late '80's when I played with some ideas. And grammar-writing languages that don't separate yacc and lex concepts work that way.
Having written recursive parsers in C++, Perl, Pascal, and others, it's clear that a "rule" is just a function that consumes input and returns true on a match. Writing that as a sub or a re doesn't matter, and is an intuitive way to do it once re becomes an object that is the "this" of embedded code like we see in P5.
I think it's good when language design progress resonates with common practice. Just let the compiler support it rather than just permit it, and give it awareness of the concepts of our current patterns.
I think Perl 6 will totally displace yacc/lex and other tools for writing grammars.
|
|---|