It can be shown that any expression matched by the grammar has a balanced number of left and right parentheses, and any nonempty initial segment of a formula has more left than right parentheses. This fact can be used to give an algorithm for parsing formulas. For example, suppose that an expression "x" begins with formula_23. Starting after the second symbol, match the shortest subexpression "y" of "x" that has balanced parentheses. If "x" is a formula, there is exactly one symbol left after this expression, this symbol is a closing parenthesis, and "y" itself is a formula. This idea can be used to generate a recursive descent parser for formulas.