Topological Grammars