in reply to Make a Syntax checker

The full on module you need to help write a syntax checker is Parse::RecDescent (or maybe Marpa) although it's a lot to get your head around! An easier approach may be Parse::RecDescent::Simple, although I have no personal experience with it. If your grammar is very simple (it seems to be) you may find Text::Balanced does the tricky bit of matching parenthesis and the rest of the checking is fairly simple to code yourself.

True laziness is hard work