Course of Raku / Regexes and grammars / Grammars / Tokens and rules / Exercises

A spaced rule

Problem

Write a grammar whose TOP is a rule that matches three words separated by spaces. Each word is a token of one or more word characters. Parse 'the quick fox' and print whether it succeeded (a plain True or False).

Example

The program prints:

True

Solution

See the solution

Course navigation

Solution: Regex versus token   |   Solution: A spaced rule