Question: 1 . ( 2 5 marks ) Provide the rules for context - free grammars that generate the following languages. ( a ) L 1

1.(25 marks) Provide the rules for context-free grammars that generate the following languages.
(a) L1={w in {a, b}
| w starts and ends with ba and contains at least one other occurrence of
ba somewhere in between}
(b) L2={a
pb
qc
rd
s
| p, q, r, s in Z
nonneg, p =4s, q > r}
(c) L3={w in {0,1}
| n0(w)>=2 and n1(w)>=1}
(d) L4={a
nx | n in Z
nonneg, x in {b, c}
,|x|>= n +2}
[For example, the strings aaabccbc and cbc are in L4, but the strings aacbc, aaabbc and
aabacccc are not.]
(e) L5={a
ib
jc
k
| i = j or j = k; i, j, k in Z
nonneg}
[For example, the strings aabbcccc, aaaaabc, abc, ccc and are in L5, but the strings
abbccc and abacc are not.]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!