Cleaned up parser function BNF with some extra tests.