World's most popular travel blog for travel bloggers.

[Solved]: Tips for creating “Context Free Grammar”

, , No Comments
Problem Detail: 

I am new to CFG's, Can someone give me tips in creating CFG that generates some language

For example

$L =\{ w v w^R \mid v,w\in \{a,b\}^*\wedge|v| \text{ is even } \}$, where $w^R$ is the reverse of string $w$.

I'm having trouble understanding the language .. I want to build DFA to convert it

Asked By : Abdallha dagga

Answered By : Hendrik Jan

Mmmm.

Let me note that in fact $L =\{ w v w^R \mid v,w\in \{a,b\}^*\wedge|v| \text{ is even } \}$ equals $\{ v \mid v \in \{a,b\}^*\wedge|v| \text{ is even } \}$.

Al strings in $L$ are of even length, and conversely all strings of even length can be otained by taking $w=\varepsilon$.

That should help.

Best Answer from StackOverflow

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

0 comments:

Post a Comment

Let us know your responses and feedback