Skip to main content

Introducing new learning courses and educational videos from Apress. Start watching

Parsing with Grammars

  • 717 Accesses

Abstract

Grammars are the proverbial Swiss-army chain saw for parsing.

This is a preview of subscription content, access via your institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • DOI: 10.1007/978-1-4842-3228-6_9
  • Chapter length: 26 pages
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
eBook
USD   29.99
Price excludes VAT (USA)
  • ISBN: 978-1-4842-3228-6
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book
USD   37.99
Price excludes VAT (USA)

Notes

  1. 1.

    Like a Swiss-army knife, but with much more power.

  2. 2.

    https://en.wikipedia.org/wiki/Recursive_descent_parser

  3. 3.

    https://en.wikipedia.org/wiki/Operator-precedence_parser

  4. 4.

    https://github.com/ugexe/zef#installation

  5. 5.

    https://github.com/tadzik/perl6-Config-INI

  6. 6.

    https://github.com/tadzik/perl6-Config-INI/blob/master/lib/Config/INI.pm

  7. 7.

    At this point it is crucial that identifier does not parse its surrounding whitespace. Hence the principle that tokens do not care about whitespace, and the rules that call those tokens parse the whitespace.

  8. 8.

    In this case, this would be harmless, because no other rule could match the rest of the variable, leading to a parse error nonetheless. But in more complicated cases, this kind of unintended backtracking can lead to errors that are very puzzling for the maintainer of the grammar.

  9. 9.

    https://docs.perl6.org/language/phasers

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and Permissions

Copyright information

© 2017 Moritz Lenz

About this chapter

Verify currency and authenticity via CrossMark

Cite this chapter

Lenz, M. (2017). Parsing with Grammars. In: Parsing with Perl 6 Regexes and Grammars. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-3228-6_9

Download citation