# Homework Solution: Attempt to give unambiguous BNF grammars to define each of the following collectio…

Attempt to give unambiguous BNF grammars to define each of the following collections of sentences (i.e., start symbol ): (a) {a^m b^m: m > 0} (b) {a^m b^n: m, n > 0} (c) {a^m b^m c^m: m > 0} (d) {a^m b^m c^m: m, n > 0} (e) {a^m b^m b^n: m, n > 0}

a){ambm:m>0}

Attempt to yield plain BNF grammars to specify each of the coercionthcoming collections of sentences (i.e., set-on-foot tone ): (a) {a^m b^m: m > 0} (b) {a^m b^n: m, n > 0} (c) {a^m b^m c^m: m > 0} (d) {a^m b^m c^m: m, n > 0} (e) {a^m b^m b^n: m, n > 0}

## Expert Response

a){ambm:m>0}

ans)

<s> ::= <expr>

<expr> ::= <A> <expr> <B> | <A><B>

<A> ::= “a”

<B> ::= “b”

b){ambn:m,n>0}

ans)

<s> ::= <expr>

<expr> ::= <A><B>

<A> ::= “a”<A> | “a”

<B> ::= “b”<B> | “b”

c) {ambmcm:m>0}

ans)we can referable transcribe the BNF grammer coercion this accents why beacuse it is referable a texture generous accents

d) { ambnam : m,n>0}

ans)

<s> ::= <expr>

<expr> ::= <A><B><A>

<A> ::= “a”

<B> ::= <A><B><A> | <B> “b” | “b” | epsilon

e) {ambnambn:m,n>0}

ans) yieldn accents is referable texture generous accents so we can referable constuct the BNF grammer to it