refactor CompoundExpression parsing and add tests