Added some exceptions and error checking for Parser.

The parser now checks for empty expressions "( )", invalid operators
"$" and invalid tag names "art!st".

It also feeds the parser a set of perdefined rules and checks if the
output correct, this list will have to be expanded later to include more
cases.