A parser would not normally handle this kind of thing with exceptions, and any cost would only be paid once, at parse time when building a syntax tree, not at execution time. Very few languages interpret text directly, rather than interpreting trees, as the trees are far easier to work with, more efficient, etc.