Course of Raku / Regexes and grammars / Grammars / The parse tree, make and made / Exercises
Reverse a word
Problem
A value attached with make does not have to be a number
— it can be any value, including a string. Write a grammar that matches
a word (one or more word characters) and, using an inline
make, attaches the word reversed (use the
flip method). Parse 'hello' and print
.made.
Example
The program prints:
olleh