3 ms·
PCRE wrappers like the module you linked don't give other langs the nice regex integration available in Perl 5, they just give them support for "Perl Compatible
by raiph 12y ago
PCRE wrappers like the module you linked don't give other langs the nice regex integration available in Perl 5, they just give them support for "Perl Compatible Regular Expressions" (hence PCRE), a rough equivalent of P5's regex functionality:
http://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions http://en.wikipedia.org/wiki/Perl_Compatible_Regular_Express...
But PCRE is 1990's parsing technology. Who cares if Nim copies parts of P5 regex via PCRE?
The page you linked says "Consider using the pegs module instead.". PEGs, invented in 2004, are more powerful than regex, PCRE ones or otherwise:
http://en.wikipedia.org/wiki/Parsing_expression_grammar http://en.wikipedia.org/wiki/Parsing_expression_grammar
Perl 6 has Perl 6 rules, a unification of PEGs, regex, and lexical closures, built right in to the language. There's nothing like them in Nim, Java, or C++.
http://en.wikipedia.org/wiki/Perl_6_rules http://en.wikipedia.org/wiki/Perl_6_rules
- progman 12y ago> There's nothing like them in Nim, Java, or C++. Are you sure? Nim supports direct access to the AST so macros can be used to define new programming constructs like in Lisp. Also other languages support things like that (as library), Java for instance: http://www.antlr.org/ http://www.antlr.org/ http://tunnelvisionlabs.com/products/demo/antlrworks http://tunnelvisionlabs.com/products/demo/antlrworks
- raiph 12y ago> Nim supports direct access to the AST so macros can be used to define new programming constructs like in Lisp. Nim macros can't modify Nim's syntax. That constraint makes perfect sense for Nim but not Perl 6. > ANTLR ANTLR has switched from LL(star) parsing to what they call Adaptive LL(star) for v4. P6 Rules have been what Larry has called "LL(star) with kludges" (by which he means the same thing) for about a decade. So ANTLR has caught up with that aspect and indeed ANTLR v4 is nice tech. But P6 Rules are built in to P6. Its grammar is defined in P6 Rules. User code can modify the language on the fly by modifying the rules. Java (or whatever) + ANTLR is nothing like Perl 6 and Perl 6 Rules.
- progman 12y ago> Nim macros can't modify Nim's syntax. Nim macros can extend Nim's syntax (additional "repeat ... until" for instance). They cannot change the built-in syntax of Nim. A macro system should never be allowed to change the core syntax of a language because that could lead to very strange errors. If Perl 6 is actually able to do that then it is a dangerous feature.