Grammar
Grammar
String
• Set of characters defined over alphabet 10010
Language ( L ) { 0 , 1 , 01 , 10 , 00 , 11 ,
• Set of all possible strings over alphabet 001 , 010 , 011, 101 ,
110 , 111 }
• It will be of form V w
Start variable
Type – 0
Recursively enumerable grammar
Type – 1
Context sensitive grammar
Type – 2
Context free grammar
Type – 3
Regular grammar
A tB | t or
A Bt | t
• Single terminal
or
• String of single terminal and single nonterminal
AΠ
where
A : single nonterminal
Π : string of terminals and/or nonterminals
String “Π” can be replaced by “A” (or vice versa) independent of its
context
αAβαΠβ
String “Π” can be replaced by “A” (or vice versa) only when it is
enclosed by the strings “α” and “β”
αβ
where
α and β both an be string of terminals and nonterminals