Skip to main content
  • Book
  • © 2017

Parsing with Perl 6 Regexes and Grammars

A Recursive Descent into Parsing

Apress

Authors:

  • Explores the three primary use cases for Perl 6 regexes: searches, validations, and parsing

  • Shows you how to master regex techniques

  • Teaches how to reuse named regexes as templates

Buy it now

Buying options

eBook USD 29.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book USD 37.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Other ways to access

This is a preview of subscription content, log in via an institution to check for access.

Table of contents (13 chapters)

  1. Front Matter

    Pages i-xiv
  2. What are Regexes and Grammars?

    • Moritz Lenz
    Pages 1-6
  3. Getting Started with Perl 6

    • Moritz Lenz
    Pages 7-16
  4. The Building Blocks of Regexes

    • Moritz Lenz
    Pages 17-32
  5. Regexes and Perl 6 Code

    • Moritz Lenz
    Pages 33-46
  6. Extracting Data from Regex Matches

    • Moritz Lenz
    Pages 47-56
  7. Regex Mechanics

    • Moritz Lenz
    Pages 57-73
  8. Regex Techniques

    • Moritz Lenz
    Pages 75-89
  9. Reusing and Composing Regexes

    • Moritz Lenz
    Pages 91-108
  10. Parsing with Grammars

    • Moritz Lenz
    Pages 109-134
  11. Extracting Data from Matches

    • Moritz Lenz
    Pages 135-145
  12. Generating Good Parse Error Messages

    • Moritz Lenz
    Pages 147-158
  13. Unicode and Natural Language

    • Moritz Lenz
    Pages 159-164
  14. Case Studies

    • Moritz Lenz
    Pages 165-194
  15. Back Matter

    Pages 195-201

About this book

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
  • Discover the building blocks of Perl 6 regexes 
  • Handle regex mechanics and master useful regex techniques 
  • Extract data and work with patterns among these use cases 
  • Reuse named regexes and other grammars as components or templates 
  • Write full parsers, including advanced error reporting and data extraction 
  • Learn how to parse nested scopes and indention-based formats



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.


Authors and Affiliations

  • Fürth, Germany

    Moritz Lenz

About the author

Moritz Lenz is a software engineer and architect.  In the Perl community, he is well known for his contributions to the Perl 6 programming language, the Rakudo Perl 6 compiler, related test suite, infrastructure and tools.  At his employer, noris network AG, he introduced continuous delivery for many in-house developed applications, and now wants to share his experience with the wider world.

Bibliographic Information

Buy it now

Buying options

eBook USD 29.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book USD 37.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Other ways to access