Course of Raku / Regexes and grammars / Grammars

Creating grammars

You have seen that a grammar groups named tokens together. This section looks at the two things that make a grammar work: the special TOP rule that describes the whole input, and the .parse method that runs the grammar against a string and gives you a match object back.

Topics in this section

Practice

Complete the quiz that covers the contents of this section.

Exercises

This section contains 3 exercises. Examine all the topics of this section before doing the coding practice.

  1. Parse a full name
  2. Parse a hashtag
  3. Parse a time

Course navigation

Solution: Year and month   |   The TOP rule