Perl 6 Grammars and Regular Expressions
An anonymous reader writes "Perl 6 is finally coming within reach. This article gives you a tour of the grammars and regular expressions of the Perl 6 language, comparing them with the currently available Parse::RecDescent module for Perl 5. Find out what will be new with Perl 6 regular expressions and how to make use of the new, powerful incarnation of the Perl scripting language."
HXGF*&#$()#P*&ULJKDFHV)(&*#$utrhk:jlhdsf(p*&#$OJDF >KLJDFP)(*$#&pyu:
Crap, I think I just accidentally programmed a web browser in Perl
It would be cool if it didn't suck.
It is good to see PERL focussing on what makes it great. There is no other language, IMHO, that handles text input as well as PERL does. Adding this level of processing just makes it even more powerful.
"...zztop-wants-a-perl-necklace dept."
i do not think that means what you think it means.
The idea of :p5 is not just that you can take Perl 5 code and modify it to make it work.
The idea is that if you don't bother to write a zillion-rule grammar to match whatever you're trying to match, you can still use the P5-style regular expressions you know and love. It's another case of Not Swatting A Fly With The Nuke.
To this user, the last several releases (5.x) have looked more like opportunities for continuing royalty streams for perl authors (new versions of old books) than significant releases.
"I'd rather be a lightning rod than a seismometer." -Ken Kesey
Therefore, it's just Perl 6 scripts which want to use Perl 5 regular expression syntax, which would want to use the :p5 modifier.
Don't get your knickers in a bunch.
[
I'm going to have to rewrite my sig.
perl -e '$_="\007/4`\cp%2,".chr(127);s/./"\"\\c$&\""/gees
Those of us that use Perl as more than just system duct-tape know it's a programming language. Perl 6 will make that even more clear by being based on OO fundamentals rather than being a procedural language with OO tacked on top of it. This is just another debate that makes the OS community look like a bunch of freaks and zealots... just like the GNU/Linux thing. Get over it and start focusing on what the software does, not how to classify/name it.
You have enemies? Good. That means you've stood up for something, sometime in your life. --Winston Churchill
I'm surprised by the regex grammar. It looks a lot like how I use boost::spirit::rule for parsing regex in C++:
:w { };
// rule for parsing a token string
// 1. Parse declarations
;-)
Perl6---
# note this is just a language example, not an accurate name matcher
grammar Names
{
rule name
rule singlename { + };
};
C++::boost::spirit---
rule split = *(*space_p >>
(+graph_p)[append(tok)] >>
*space_p);
msg "Parsing input\n";
while (!header_ok && getline(input, line) && input.good())
{
tok.clear();
parse(line.c_str(), split);
There are even grammar classes in Spirit.
I sure hope perl6 is faster!
https://www.accountkiller.com/removal-requested
I've got a fully multithreaded perl script running under Win32. It wasn\'t too bad to write but some parts sucked. One of the things sucked because Win32 doesn't support alarm() calls and you have to manually poll sockets and I hate that shit, or use vec() and that's just insane (how many people understand how vec() works anyway???) The other big thing that sucked was the crappy mechanism for sharing complex data structures between threads. All's honky-dory if you're just sharing a scalar variable, but don't try a HoH or anything like that cause you'll find out that there's no auto-vivification, and you have to manually create the data structure in every thread that needs to access it, and that right there leads to lots of possibilities for "interesting" bugs to show up (it's not very fun to code or pretty to look at or understand once it's done).
But anyway none of that is really here nor there, but I just wanted to comment that Perl "scripting" isn't just CGI forms and stuff like that. You can really do complex applications in Perl. It's a full-featured language, portable (moreso that even Java, just look at the list of archs in the Configure.sh script), and able to handle most tasks that don't require a tiny memory footprint or direct CPU register manipulation.
Note to those ready to mod me Troll/Flamebait: I'm not trying to pick on Python, I just happened to be acquainted with this candid quote.
The grammars appear to be in a class called "context free languages"(CFGs). Some CFGs are ambiguous in the sense that a given "sentence" can be derived from more than one set of rules. Traditional tools such as yacc/bison tell you where there is ambiguity in your rules - even then it isn't always easy to remove the ambiguity (trust me on this). If the Perl 6 system doesn't help the programmer debug the grammar he/she will not be happy when the parsing doesn't work as expected.
In addition, the article ends the description of features with "And much more...". It appears that Perl 6 grammars are more powerful than CFGs. If they can simulate a Turing machine...
No electrons were harmed creating this post, though some may have been subjected to electrical and/or magnetic fields.
Thus spake Larry Wall in Apocalypse 5:
And from Apocalypse 1:
In other words, it is backwards compatible, it isn't backwards compatible, and when you install Perl 6, you are installing both.
TTFN
(I'm a recovering language bigot so I can say this. :-P )
I'm studing seriously the posibility of tackling a whorty coding proyect, the rewriting of the entire LINUX kernel on a languaje very much but not unlike C and was considering doing it in C-INTERCAL but after seing things like this http://ozonehouse.com/mark/blog/code/PeriodicTable .html , I changed my mind and will use PERL 6 instead.
And I have prayed unto You, O Lord U**X in the time of the Will of Linux.
I think you went about things the wrong way. Why would you ever look at the nitty gritty syntax rules first when trying to learn a language. First do some simple examples to get the general feel of the langauage. Then learn the nitty gritty stuff as required.
"IMO, "the right job" for perl is about 2% of all programming tasks out there."
76 percent of all statistics..... You get the point. You really dont have any valid point here, every language is designed to do certain things, and people will use it for those things and more. Trying to say whats the best langague out there is stupid. Trying to say what percent of projects perl should be used on is also stupid.
"It can accomplish this, but not without the reader having to go through the mental gyrations of what could be best called linguistic decompression."
Have you tried to program in a logical language lately? Have you tried to program in a functional language lately? Have you tried to program in anything but your standard imperical/oo language lately? There are tons of styles of languages, and each one required its own linguistic decompression. Which one feels more natural its a matter of opinion.
Selling software wont make you money, selling a service will.
When I started to learn Perl (coming from a C background) I had quite a different experience. I really felt I had "come home", or something like that. Sure, you can write obscure code, but that's no different from C. But you don't have to, it can be very clear.
I'll give credit to the fact that perl is compact, terse, to the point and has a reputation for string manipulation.
I just love it for the short development times, and the fact that you can really use it for just about any environment. Want to do CGI? Sure! Just GUI? No problem! Connect to about every database there is, that's no biggie.
And what about CPAN? That's a part of Perl too! You get all that ready-to-run code for just about any problem domain.
IMO, "the right job" for perl is about 2% of all programming tasks out there.
Maybe you are right, but somehow I get a lot of those 2% jobs... ;-)
Now you have to excuse me, I have some perl coding to do! ;-)
!ERR: Signature not found.
... so when I need a webserver, I just
/dev/urandom | perl
$ cat
It usually works in 3 tries or less.
HAND.
Yes, it does include a lot of symbols, but there is payback to learning them, and really most programs won't use much beyond $ % # () [] {}. Unlike some languages, Perl is not what I would describe as a 'bondage' language. If you want to program sloppy, you can program sloppy. That's fine by Perl. And this generousity is what gives Perl its bad reputation. This is funny since I and most knowledgeable Perl programmers can write perfectly clear and maintainable code. The way we do this is no secret--it's just by commenting appropriately, using meaningful identifier names and following the Perl style guidelines.
People can mock Perl all they like, but it is still a widely used powerful programming language and I am more productive in it than any other language. As a parting comment, a Cisco employee once told me (off the record of course!) that "Cisco would fall apart without Perl".
LRC, the best-read libertarian site on the web
The
And once you get used to RUBY, you'll never go BACK to PERL. You'll ALSO stop spelling random words that aren't acronyms all in caps, like Perl, Ruby, Java and Unix.