Differentiate between context free and context sensitive grammar .

  • Answered by Nemi
  • 10 months ago

The difference between context free grammar and context sensitive grammar are:

Context free grammar Context sensitive grammar
1.In context free grammar, there will be no context. 1. In context sensitive grammar, there is either left context or right context.
2.It is a set of recursive rules used to generate patterns of strings. 2.It is a  formal language  in which the left-hand sides and right-hand sides of any production rules may be surrounded.
3.It can describe all regular languages but cannot describe all possible languages. 3.There are languages that can be described by a CSG but not by a context-free grammar.
4.CFG are studied in the field of theoretical computer science, design etc. 4.CSG can describe  the syntaxes of some visual programming language.
5.It has four-element tuple (V,Σ,R,S), R is a set of production rules where each production rule maps a variable to a string. 5.It also has four-element tuple G=(Σ, VSP), P is also a set of production rules but does not maps each production rule.
If you found any type of error on the answer then please mention on the comment or report an answer or submit your new answer.
Leave your Answer:

Click here to submit your answer.

Notify of
Inline Feedbacks
View all comments