This class explores the advanced features of the Regexp::Grammars module and demonstrates the wide range of powerful parsing techniques the module makes possible.
Topics covered include:
- Rematching parsed data
- Balanced delimiter matching within data
- Aliasing literals
- Extracting location data within a match
- Line counts
- Passing location information to error messages
- Message localization within a parser
- Localized whitespace skipping within rules
- Parametric subrules
- Accessing parameters
- Matching subrule parameters as subpatterns
- Matching subrule parameters as literals
- Matching subrule parameters as balanced delimiters
- Table-based matching with custom key patterns
- Subrule stubbing
The Regexp::Grammars module is the successor to the Parse::RecDescent module. It offers most of the same features, with important extra capacities such as full backtracking support whilst parsing, as well as grammar inheritance (as in Perl 6).
Perl programmers who are already familiar with the basics of grammar-based parsing and with the Regexp::Grammars module. The techniques presented are not restricted to the specific applications mentioned, and will be useful to anyone who needs to process complex structured input of any kind.