Boolean expression evaluator

Write codeMedium30 min

Your task

A boolean expression is given as a string using the grammar: t (true), f (false), !(expr) (NOT), &(e1,e2,...) (AND of one or more sub-expressions), and |(e1,e2,...) (OR of one or more sub-expressions). Sub-expressions are comma-separated and may nest arbitrarily. Parse and evaluate the expression and return the resulting boolean. Assume the input is always well-formed.

Examples

parse_bool(expr: str) -> bool
Example 1
Inputparse_bool("&(t,f)")
OutputFalse