It doesn&#x27;t need a full AST. It needs a tokenizer and a nesting level or potentially a stack of different classes of token nesting.<p>This parser would not be difficult to write; the only &quot;recovery&quot; is in choosing how to react to mismatched token pairs. The simplified problem means heuristics could potentially be used.