0
$\begingroup$

I am fairly new to automata, regular expressions and regular grammar. I am struggling to understand how to define the regular expression (abc)* into one or several regular grammar expressions. Following production rules are applied

  1. N={S,A,B}
  2. Σ={a, b c}
  3. S being the start symbol

So far i have found these two.

S → aA

A → bB

B → cS

S → ε

and

S → Ac

A → Bb

B → Sa

S → ε

Are both of the grammars over correct or do i have the wrong idea? I just dont understand why the two grammars over are correct while the bottom two are not.

S → aA

A → bB

B → cS

B → c

and

S → Ac

A → Bb

B → Sa

B → a

$\endgroup$
5
  • 3
    $\begingroup$ Looks fine to me. What doubts did you have that this wasn't right? By the way, two things: (1) Welcome to the site! (2) These "check my results" posts are discouraged here; we'll be happy to clear up things you don't quite understand, but in those cases you should help us help you by pointing out where you don't get what's going on. $\endgroup$ Mar 25, 2020 at 18:05
  • $\begingroup$ Thank you for the welcome! I understand, i didn't know quite how to formulate myself. I will articulate the question better next time. Well the reason why i was wondering if wasn't right was because of the test i ran in JFLAP. First i generated random strings using my regular expression (abc)* then i tested those for match using the regular grammar expressions. Two of them had full match while the two i listed here didn't. I got confused to as why that would happen if they were the same in the first place. I hope that made sense. $\endgroup$
    – Dusan Biga
    Mar 25, 2020 at 18:18
  • $\begingroup$ I don't understand what "full match" means but it scarcely matters--your answer is correct. It might be nice to edit your original post to include your clarifying comment. Who knows? Maybe there's a JFLAP expert here who'll say "Yeah, that's a known bug, they say they're working on a fix." $\endgroup$ Mar 25, 2020 at 23:23
  • $\begingroup$ Would you care to explain why the two solutions on top are correct while the two a the bottom are not? $\endgroup$
    – Dusan Biga
    Mar 26, 2020 at 1:24
  • $\begingroup$ Is the empty string in the language with the first two grammars? Is it in the languages generated by the third and fourth? $\endgroup$ Mar 26, 2020 at 18:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.