Consider the following context-free grammar 𝐺, where 𝑆, 𝐴, and 𝐵 are the variables (non-terminals), 𝑎 and 𝑏 are the terminal symbols, 𝑆 is the start variable, and the rules of 𝐺 are described as:
𝑆 → 𝑎𝑎𝐵 | 𝐴𝑏𝑏
𝐴 → 𝑎 | 𝑎𝐴
𝐵 → 𝑏 | 𝑏𝐵
Which ONE of the languages 𝐿(𝐺) is accepted by 𝐺?
L(G) = { a²bⁿ | n ≥ 1 } ∪ { aⁿb² | n ≥ 1 }
L(G) = { aⁿb²ⁿ | n ≥ 1 } ∪ { a²ⁿbⁿ | n ≥ 1 }
L(G) = { aⁿbⁿ | n ≥ 1 }
L(G) = { a²ⁿb²ⁿ | n ≥ 1 }
Let S → aaB S → aaB S → aaB
→ aab → aabB → aabB
→ aabb → aabbb
Let S → Abb S → aAbb S → aAbb
→ aab → aabb → aaAbb
→ aaabb
l = { aab, aabb, abb, aaabb, aaabbb, ... }
Then,
L(G) = { a²·bⁿ | n ≥ 1 } ∪ { aⁿ·b² | n ≥ 1 }