Sobes.tech
Junior — Senior

Parser for multiple Polish notation with addition and multiplication operations

livecode

Task condition

It is required to implement a parser for Polish notation, where operations can take an arbitrary number of arguments. Only two arithmetic actions are supported: addition and multiplication.

Example of Polish notation: (+ 2 4) → 2 + 4 → 6 (* (+ 3 6) (* 1 2 3)) → (3 + 6) * (1 * 2 * 3) → 9 * 1 * 2 * 3 → 54