I'm struggling to find the context-free grammar for the following language: $$ L = \{a^sb^tc^m:s,t,m\in\mathbb{N}^+\land1\leq t\leq3\land s\times t=m\} $$ Any help would be appreciated.
Asked
Active
Viewed 142 times
0
-
https://cs.stackexchange.com/q/18524/755 – D.W. Mar 26 '20 at 19:09
1 Answers
3
Write $L$ in the following way: $$ L = \{ a^sbc^s : s \in \mathbb{N}^+ \} \cup \{ a^sb^2c^{2s} : s \in \mathbb{N}^+ \} \cup \{ a^sb^3c^{3s} : s \in \mathbb{N}^+ \}. $$

Yuval Filmus
- 276,994
- 27
- 311
- 503