Can a context-sensitive grammar have an empty string?

516 Views Asked by At

In one of my cs classes they mentioned that the difference between context-free grammar and context-sensitive grammar is that in CSG, then the left side of the production rule has to be less or equal than the right side. So one example they gave was that context-sensitive grammars cant have an empty string because then the first rule wouldnt be satisfied. However I have understood that regular grammars are contained in context-free, context-free are contained in context-sensitive, and context-sensitive are contained in recursive enumerable grammars. so for example if a grammar is recursive enumerable then is also of the type context-sensitive, context-free and regular. The problem is that if this happens, then if I have a context-free grammar that contains an empty string then it would not satisfy the rule to be counted as a context-sensitive but then a contradiction would occur because each context-sensitive is context-free.