-1

For a context free grammar for L{a^n b^m c^t where t>0,m>0,n>2}

S -> ABC
A ->aB|a
B ->bB|b
C ->cC|c

Is this correct?

General Grievance
  • 4,555
  • 31
  • 31
  • 45
  • Welcome to Stack Overflow. Please take the [tour] to learn how Stack Overflow works and read [ask] on how to improve the quality of your question. Then check the [help/on-topic] to see what questions you can ask. You might want to delete this question and ask it on https://cs.stackexchange.com/ instead, but check the help pages there first. – Progman Jun 15 '21 at 20:38

1 Answers1

1

This is incorrect. Your current grammar would allow the solution abc which is not part of your grammar since a does not appear more than two times.

It can be constructed the following way:
S -> ABC -> aBC -> abC -> abc

I would suggest the following grammar:

S -> aaABC
A -> aA|a
B -> bB|b
C -> cC|c

Michael Kotzjan
  • 2,093
  • 2
  • 14
  • 23