book - Parsing With Perl 6 Regexes and Grammars, 2017, Moritz Lenz, Apress

This book is awesome despite the errors I spotted. I have read it almost from cover to cover. It's hard, because parsing requires hierarchical thinking. Translate that into code and it's a recipe for confusion.

The part where one learns about whitespace handling and the differences between regex, token, and rule is especially confusing.


If the predefined <ws> construct is equivalent in code as

regex ws { <!ww> \s*}

then clearly it matches zero to many different whitespace characters unless it's within a word. The two fatal errors are: "at least one" and "unless it's at a word boundary".