News for hackers. Stuff that matters.
Re:Exploring the Linguistics Behind Regular Expressions by zokier on Sunday March 04, 2018 @04:10PM (#16516759)
Also breaks with the traditional regexp by not actually being regular expressions :)
Re:Exploring the Linguistics Behind Regular Expressions by raiph on Tuesday March 06, 2018 @08:03AM (#16528552)
There have been two such breaks, not one. Perls 1-5 correspond to the first such break. Perl 6 corresponds to the second.

If "regular expressions" is taken to refer to formal language theory regular expressions -- which is NOT what 99% of devs mean by the terms regex or regular expressions -- then "breaks with the tradition" (formal language theory "tradition") happened somewhere in the 1960s to 1980s timeframe, when capturing parens and backreferences were introduced in [qs]?ed or similar. (Years before the first Perl arrived in 1987 to popularize and extend said break with tradition.)

If "traditional regexp" is instead taken to refer to this latter notion of "regular expression", i.e to match what 99% of devs DO mean by the terms regex or regular expression -- Perl 5 compatible regexes, PCRE, etc. -- then Perl 6 represents a second break with tradition, breaking away from the currently still popular Perl 5 "tradition".

In other words:

* "Regex" meaning 1: formal regular expressions (from 1950s)

* "Regex" meaning 2: Perl (5) compatible regexps (from 1960s)

* "Regex" meaning 3: Perl 6 rules[1] (first officially available 2015)

[1] "Perl 6 rules are the regular expression, string matching and general-purpose parsing facility of Perl 6 ..." (https://en.wikipedia.org/wiki/Perl_6_rules)

Re:Exploring the Linguistics Behind Regular Expressions by brianon99 on Wednesday March 07, 2018 @05:54AM (#16535598)
I think what most people mean when they say 'regex' is actually 2 thing:

1. The syntax of that pcre-like regex engine accept.

2. regular language, a kind of formal language.

Many regex engine nowadays like the one in perl5 and onigmura already breaks 2, but still makes 1 compatible. I think what perl6 does is also breaks 1. (I am not experienced in Perl6. Please correct me if I am wrong.) I don't think it is a problem, though.

Re:Exploring the Linguistics Behind Regular Expressions by b2gills on Monday March 12, 2018 @11:06PM (#16573638)
In Perl 6 regexes are a type of method, and you can use them in grammars which are a type of class. (You can use them on their own as well)

Which means you can subclass grammars, compose in regexes with roles, and have parameterized regexes.

The syntax has also had an overhaul to make it more consistent with itself as well as the rest of Perl 6. Since you can embed Perl 6 code, some features of other regular expression engines haven't been implemented as they aren't needed.

The result of using a regex or grammar is also now a parse tree rather than True/False or the matched substring.

I generally recommend reading the code for JSON::Tiny::Grammar as a quick example of what it is like. https://github.com/moritz/json/blob/master/lib/JSON/Tiny/Gra...

Re:Exploring the Linguistics Behind Regular Expressions by bmn__ on Tuesday March 13, 2018 @04:51AM (#16574614)
> I think what perl6 does is also breaks 1.

No, you can use the backward-compatible syntax if you don't want to spend any time porting to the newer improved syntax.

https://docs.perl6.org/language/regexes#Perl_5_compatibility...

http://design.perl6.org/Differences.html#New_regex_syntax

https://docs.perl6.org/language/5to6-nutshell#Add_:P5_or_:Pe...