World's most popular travel blog for travel bloggers.

[Solved]: Regular Expression as basis for creating this grammar

, , No Comments
Problem Detail: 

I made a right-linear grammar from a regular expression:

The alphabet is:

$Σ = \{a, b, c\} $

Regular expression:

$r = cc^{*}(ba)^{*}bb$

My solution, it seems a little too short like I'm leaving something out. Maybe someone can see where I went wrong on the right-linearity:

$ S \to cA $

$ A \to b a A | B | cA $

$ B \to bb $

Asked By : stackuser

Answered By : Subhayan

$A \rightarrow ba \mid A \mid B \mid cA$

under this $bababaccc$ is also legal


You could try something like this...

$S \rightarrow cS|cA$

$A \rightarrow baA|B$

$B \rightarrow bb$

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/14849

3.2K people like this

 Download Related Notes/Documents

0 comments:

Post a Comment

Let us know your responses and feedback