Skip to main content

Parsing with Grammars

  • Chapter
  • First Online:
Parsing with Perl 6 Regexes and Grammars
  • 778 Accesses

Abstract

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

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
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

Purchases are for personal use only

Institutional subscriptions

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

Check for updates. 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

Publish with us

Policies and ethics