Course of Raku / Regexes and grammars / Grammars / The parse tree, make and made / Exercises

Multiply a pair

Problem

Write a grammar that parses two numbers joined by a *, as in '4*5', and uses an inline make to store their product. Parse '4*5' and print .made.

Example

The program prints:

20

Solution

See the solution

Course navigation

Solution: Extract the number   |   Solution: Multiply a pair