Perl 6 Grammars – not only for parsing
ttjjss.wordpress.com
Perl 6 Grammars – not only for parsing
1–10 of 14 posts
Re: Perl 6 Grammars – not only for parsing
#2Re: Perl 6 Grammars – not only for parsing
#3It would be wonderful if someone more familiar with Perl 6 could give a code break-down of what is going on.
The grammar is something new in Perl 6, but it looks like there are a bunch of regexes that match different tokens. That makes me wonder how well it handles a buggy, ambiguous grammar, where the regexes overlap and something could be parsed as a token of two or more types. First rule wins?
Guess I should read some of chromatic's book over Thanksgiving so I'd understand more of this...
Re: Perl 6 Grammars – not only for parsing
#4It would be wonderful if someone more familiar with Perl 6 could give a code break-down of what is going on.
I only know Perl 5, but I can figure out enough of it to give an educated guess. It seems like he's using the token returned by the grammar to select a method of the same name. So when he gets the token e404, he'll call the method e404 which does a make "404: Not found" The grammar is something new in Perl 6, but it looks like there are a bunch of regexes that match different tokens. That makes me wonder how well it…
Mysite.parse($req, :actions(Mysite::Actions.new))
says "Parse $req using grammar Mysite and actions Mysite::Actions.new." When a token is found, the action method with the same name is called. As I understand it, the idea with separating token and action like that is one grammar can be associated with more than one set of actions.Re: Perl 6 Grammars – not only for parsing
#5Once upon a time, Perl was the de facto language for web development. Then there was a bit of falling out between the web-centric folks and the server-centric folks; resulting in PHP. Perl, as a language for web-development, never really recovered.
I find it kind of sad that it took over a decade and a half-hearted attempt at rewriting the language before the server-centric folks are even beginning to understand what the web-centric folks were talking about. :-/
Re: Perl 6 Grammars – not only for parsing
#6Congratulations, Perl 6 developers. You are beginning to catch up with Django. (See http://docs.djangoproject.com/en/dev/intro/tutorial03/ if you think I'm being sarcastic.) Once upon a time, Perl was the de facto language for web development. Then there was a bit of falling out between the web-centric folks and the server-centric folks; resulting in PHP. Perl, as a language for web-development, never really recovere…
I can say about Perl 5 - check out Catalyst framework. I am pretty sure (if you throw away all prejudices) you will like it. Especially, check their chained actions.
This is web side. Can't say anything about server side, since I am using perl for web projects.
Re: Perl 6 Grammars – not only for parsing
#7Congratulations, Perl 6 developers. You are beginning to catch up with Django. (See http://docs.djangoproject.com/en/dev/intro/tutorial03/ if you think I'm being sarcastic.) Once upon a time, Perl was the de facto language for web development. Then there was a bit of falling out between the web-centric folks and the server-centric folks; resulting in PHP. Perl, as a language for web-development, never really recovere…
(I approve of Python's named captures, though even Perl 5 has had those for almost three years now.)
... over a decade and a half-hearted attempt at rewriting the language...
In truth, the Perl 6 redesign began a few months after Python 3000, in July 2000.
Re: Perl 6 Grammars – not only for parsing
#8Congratulations, Perl 6 developers. You are beginning to catch up with Django. (See http://docs.djangoproject.com/en/dev/intro/tutorial03/ if you think I'm being sarcastic.) Once upon a time, Perl was the de facto language for web development. Then there was a bit of falling out between the web-centric folks and the server-centric folks; resulting in PHP. Perl, as a language for web-development, never really recovere…
Assume I'm barely competent at both Perl and Python. Can you explain how looping over repeated regular expressions is more powerful and useful than core language support for grammars and arbitrary tree transformations? (I approve of Python's named captures, though even Perl 5 has had those for almost three years now.) ... over a decade and a half-hearted attempt at rewriting the language... In truth, the Perl 6 redes…
Re: Perl 6 Grammars – not only for parsing
#9Congratulations, Perl 6 developers. You are beginning to catch up with Django. (See http://docs.djangoproject.com/en/dev/intro/tutorial03/ if you think I'm being sarcastic.) Once upon a time, Perl was the de facto language for web development. Then there was a bit of falling out between the web-centric folks and the server-centric folks; resulting in PHP. Perl, as a language for web-development, never really recovere…
Re: Perl 6 Grammars – not only for parsing
#10Congratulations, Perl 6 developers. You are beginning to catch up with Django. (See http://docs.djangoproject.com/en/dev/intro/tutorial03/ if you think I'm being sarcastic.) Once upon a time, Perl was the de facto language for web development. Then there was a bit of falling out between the web-centric folks and the server-centric folks; resulting in PHP. Perl, as a language for web-development, never really recovere…
Assume I'm barely competent at both Perl and Python. Can you explain how looping over repeated regular expressions is more powerful and useful than core language support for grammars and arbitrary tree transformations? (I approve of Python's named captures, though even Perl 5 has had those for almost three years now.) ... over a decade and a half-hearted attempt at rewriting the language... In truth, the Perl 6 redes…
If you want others to see the utility of these Perl 6 features, they're going to need side-by-side syntax-highlighted clear-as-day examples. Otherwise it's just, "must be some weird Perl 6 feature -- the way I'm doing it in blub works fine for me".