0
$\begingroup$

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.

$\endgroup$
1
3
$\begingroup$

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}^+ \}. $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.