Parsing with Perl 6 Regexes and Grammars: A Recursive Descent into Parsing
Write good regexes and parsers with the Perl 6 programming language. You’ll see how regexes are used for searching, parsing, and validation: in particular the grammar extension makes them uniquely suitable for parsing, the main focus of this book. Written by Perl 6 expert Moritz Lenz, a core contributor of Rakudo, Parsing with Perl 6 Regexes and Grammars starts from the very basics of regular expressions, and then explores how they integrate with regular Perl 6 code. Then follows a deeper exploration of how regexes work under the hood and a discussion of common techniques for constructing regexes and exploring the data under scrutiny. Later material goes beyond relatively simple formats to reusable named regexes and grammars, which permit code reuse in grammars, and shows how to write parsers for more involved data formats. Error reporting and case studies wrap up the topic.
While regexes allow you to search for patterns in text and validate input, Perl 6 regexes advance that concept: you’ll see how they are easier to read, yet much more powerful, than the traditional "Perl-compatible regular expression". With improved reusability and backtracking control, you will be able to write complete parsers with the help of this book.
What You'll Learn
Who This Book Is For
Those with at least some prior experience with Perl programming, but who may be new to Perl 6 as well as searching and parsing.
What people are saying - Write a review
We haven't found any reviews in the usual places.
Other editions - View all
abstract syntax tree action methods action object allow anchors array atom backslash backtracking character classes code block data formats declaration delimited elements error messages error reporting escape sequence example grapheme grapheme clusters Hello identifier indentation infix INI file input string inside install JSON keyval leave_scope left recursion lexical analysis mabra match object match of string matches the whole MathExpression modifier Moritz Lenz 2017 named capture named regex newline operator precedence parser Output parse mathematical expression parse tree Parsing with Perl Perl 6 code Perl 6 Regexes perl6 produces programming languages proto token quantifier quoted string Rakudo Perl recursion regex call regex engine regex match Regexes and Grammars Regular Expressions regular languages rejection of string S-Expression scope self.pos subroutine Successful match symbol table syntax termlist token number token term token TOP token value Unicode whitespace word boundary