Sep 26, 2024
α → β
Type 0 Grammar (Unrestricted Grammar)
α
and β
can be any combination of terminal and non-terminal symbols.S → AAB
, A → B
Type 1 Grammar (Context Sensitive Grammar)
α
and β
can be any combination of terminals and non-terminals.α
<= Length of β
.S → AAB
, AA → B
Type 2 Grammar (Context-Free Grammar)
α
must be a non-terminal symbol.β
can be any combination of terminal and non-terminal symbols.S → AAB
, A → AA | B
Type 3 Grammar (Regular Grammar)
α
must be a non-terminal symbol.β
can either be a terminal followed by a non-terminal or just a terminal.A → aB | a
S → ASB | ε
S → AS | BS | ε | A | B
A
, B
, AA
, ABBA
.AAB
, the derivation could be shown as:
S → ASA → AAB