Logical Representation of Grammatical Systems