2
$\begingroup$

I need to give the LL grammar for the language below and explain why the grammar is LL and what the value of $k$ should be:

$$L = \{ a^n c^m c^{n+m} : n \ge 1, m \ge 1 \}. $$

I have the following, but it works for $n \ge 0$ and $m \ge 0$. I'm not sure how to get rid of that case where $n$ and $m$ are 0.

$$ \begin{align*} &S \to aSc \mid Z \mid \lambda \\ &Z \to bZc \mid \lambda \end{align*} $$

$\endgroup$
  • 1
    $\begingroup$ Do you mean $a^nb^mc^{n+m}$? And do you denote by $\lambda$ the empty string? $\endgroup$ – xskxzr Apr 10 '18 at 12:21

Your Answer

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

Browse other questions tagged or ask your own question.