Describe In English, the language defined by the following grammar in BNF. The s
ID: 3842839 • Letter: D
Question
Describe In English, the language defined by the following grammar in BNF. The start symbol is <S>
<S>:= <A>| <B>
<C> := a|b|c
<A> := a<A>a | a<B>a | <C>
<B>:= b<A>b | b<B>b | <C>
For example the answer would be something along the lines like this:
<A> will generate one or more consecutive a's
<B> will generate one or more consecutive b's
<C> will generate one or more consecutive c's
So <A><B><C> will generate
One or more a's followed by one or more b's followed by one or more c's
If I dont see something similar to above, I am going to give a thumbs done rating
Explanation / Answer
The language generated by the grammer is
1) a S->A,A->C,C->a
2) b S->A,A->C,C->b
3) c S->A,A->C,C->c
4) all odd length words with a's S->A,S->aAa,S->aaAaa,.............finally A is replaced with a so we will get odd length of a's
5) all odd length words with b S->B,S->bBb,S->bbBbb.............finally B is replaced with b so we will get odd length of b's
6) apbap where p is any positive integer S->A,S->aAa,S->aaAaa,.......finally A is replaced by C and C is replaced by b
7) apcap where p is any positive integer same as above but at the End C is replaced by c
8)bpabp where p is any positive integer S->B,S->bBb,S->bbBbb ......finally B is replaced by C and C is replaced by a
9)bpcbp where p is any positive integer same as above but at the end C is replaced with c
10)ambnabnam where m,n are any positiver integers and m and n may or may not be equal
11)ambnbbnam where m,n are any positiver integers and m and n may or may not be equal
12)ambncbnam where m,n are any positiver integers and m and n may or may not be equal
13)bmanaanbm where m,n are any positiver integers and m and n may or may not be equal
14)bmanbanbm where m,n are any positiver integers and m and n may or may not be equal
15)bmancanbm where m,n are any positiver integers and m and n may or may not be equal
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.