Comment by perlgeek

3 months ago

I really wish more languages would "steal" grammars from raku (formerly Perl 6).

A grammar is basically a class (or role/trait), and they can contain regexes (and regular methods). Those regexes have backtracking control (for simple tokens, you don't want to to try parse a string any other way than the first, obvious match).

This makes it much easier to write composable and understandable parsers.

I know that, technically, you could do that in a library, but somehow that's never the same; if it's not baked into the language, the hurdle to introduce another dependency is always looming, and then if there's more than one such library, the parsers aren't composable across libraries and so on.

Hi Perlgeek, long time no see!

I really wish more people would use Raku :-) Because it is all built in there already! :-)