Linear Grammars
Grammars with
at most one variable at the right side of a production
Examples:
A
aAb A
Ab S
S
aSb
S
A Non-Linear Grammar
bSa S
aSb S
S
SS S
Grammar :
G
)}
( )
( :
{ )
( G w n w n w
L
a
bAnother Linear Grammar
Grammar :
Ab B
aB A
A S
|
} 0 :
{ )
( G a b n
L
n nG
Right-Linear Grammars
All productions have form:
Example:
xB A
x A
or
a S
abS S
string ofterminals
Left-Linear Grammars
All productions have form:
Example:
Bx A
a B
B Aab
A
Aab S
|
x A
or
string of terminals
Regular Grammars
Regular Grammars
A regular grammar is any
right-linear or left-linear grammar Examples:
a S
abS S
a B
B Aab
A
Aab S
|
G
1G
2Observation
Regular grammars generate regular languages Examples:
a S
abS S
a B
B Aab
A
Aab S
| G
1G
2Regular Grammars Generate
Regular Languages
Theorem
Languages
Generated by
Regular Grammars
Regular
Languages