Implement the parser's expect() function

Also start implementing parser tests.