Automata
Automata
GRAMMAR (CFG)
THEORY OF AUTOMATA
INSTRUCTOR: SIR SHAHZAD
ZARYAB AMJAD (04)
Introduction to Context-Free Grammar
(CFG)
- Terminals: These are the basic symbols of a
language that appear in the final output and
cannot be broken down or replaced further.
- Example: S → aS | b
Context-Free Language
(CFL)
- A CFL is a language generated
using a context-free grammar.
- Examples:
- S → aS | Λ produces all strings
of ‘a’ (i.e., a*).
- S → aSa | bSb | Λ generates all
palindromes (strings that read the
same forward and backward).
Derivation Trees and Ambiguity in CFG
- Derivation Tree: Also called a parse
tree, it shows the step-by-step
application of rules to derive a string
from the start symbol.