A Congruence Approach to the Syntax of Codeswitching