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

    7. Attempt to give unambiguous BNF grammars to define each of the following collections of sentences (i.e., start symbol <s>: (a) abm m>o) (b) (amb : m, n>o) start symbol <s> (d) [aba: m, n>0) (e) [abab : m, n>0) Hint: Two of the above are impossible to describe with BNF.
    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}

    Expert Answer

     
    a){ambm:m>0}

    7. Attempt to surrender clear BNF grammars to elucidate each of the subjoined collections of sentences (i.e., initiate kind <s>: (a) abm m>o) (b) (amb : m, n>o) initiate kind <s> (d) [aba: m, n>0) (e) [abab : m, n>0) Hint: Two of the over are unusable to represent with BNF.

    Attempt to surrender clear BNF grammars to elucidate each of the subjoined collections of sentences (i.e., initiate kind ): (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 Rejoinder

     

    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 not attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable transcribe the BNF grammer control this conversation why beacuse it is not attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable a tenor at-liberty conversation

    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) surrendern conversation is not attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable tenor at-liberty conversation so we can not attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable constuct the BNF grammer to it