Course of Raku / Addendum 🆕 / Types and text machines / Regexes and grammars / Exercises

A grammar that adds

Problem

Write a grammar that parses a sum like 3+4+5, and an action class that computes the total while parsing. Print the result.

Example

The program prints:

12

Solution

See the solution

Course navigation

Solution: A grammar for full names   |   Solution: A grammar that adds