7,576 views
1 votes
1 votes

Find context free grammars for the following languages (with n>=0, m>=0, k>=0)

(a) L={anbmck : n=m or m<=k}

(b) L={ anbmck : n=m or m≠k}

(c) L={anbmc : k=n+m }

(d) L={ anbmck : n+2m=k}

(e) L={anbmck : k=|n-m| } 

(f) L={ w ∈ {a,b,c}* : na(w)+nb(w)≠nc(w) }

(g) L={ anbmc : k≠n+m }

(h) L= { anbmck : K>=3} 

5 Answers

0 votes
0 votes

(a)

 

S→A | B

A→ CD

C→ aCb | ϵ

D→Dc | ϵ

B→EF

E→aE | ϵ

F→bFc | G
G→Gc | ϵ 


 

 

0 votes
0 votes

(b)

S→A | B
A→ CD

C→ aCb | ϵ

D→Dc | ϵ

B→EF

E→aE | ϵ

F→bFc | G |  H

G→Gc | ϵ

H→bH | ϵ 

Related questions

0 votes
0 votes
3 answers
3
Ayush Upadhyaya asked Mar 19, 2017
1,292 views
Is the following language context-free?L= { uvwvR : u,v,w∈ {a,b}+ |u| = |w| =2 }If yes, provide set of productions for the same.
1 votes
1 votes
2 answers
4
Ayush Upadhyaya asked Mar 19, 2017
2,092 views
Give a context-free grammar for the language below :(n>=0, m>=0)L= { w ∊ {a,b}* : na(w)=2nb(w)+1}