Foundations of Cognitive Gramar