in reply to Re^4: Perl 6 grammar question
in thread Perl 6 grammar question
This is good as well... But my point was that this is not the same as controlling the parsing itself.
I know, and it's not always true. In theory, the module could control the parser to create said if/then structure, and that would be great.
It's even possible to do this in Perl5 using source filters. When you using filters, you need to provide a parser. Seeing as you have to write the parser, you are definitely controlling it.
What I meant was, take for example 'given', it can be implemented in a module using if/else statements
Unfortunately, not really. Perl5 is not expendable in that manner without using source filters.
Filters replace the builtin parser. That means you need to completely reimplement a Perl parser if you want that resembles Perl. That's what Switch does and that's why it's a source of headaches.
What you actually want is integration into the existing parser, starting with the ability to add keywords. And that's what Perl6 can do.
* — Perl doesn't differentiate modules from scripts. It's all Perl code.
|
|---|