An exercise in grammars

This exercise is for your review only, and is not to be turned in.  A solutions sheet will be available shortly.

 

Consider the grammar we discussed in class:

E -> T | E + T | E - T

T-> F | T * F | T / F

F-> x | y | z  | ( E )

Create derivations and parse trees for the following expressions:

(I will be able to provide derivations in the solutions handout:  Please see me if you have questions about the parse trees (I need a html drawing tool!).

Another useful grammar (that we have seen before) is:

    S -> NP VP

    NP -> DET N

    N -> ADJ N | boy | dog | ball

    ADJ -> big | small | red

    VP -> V NP

    V -> chased | bit

    DET the | this | a

Create derivations and parse trees for THE BIG DOG CHASED THE SMALL BOY

Finally, an exercise from Wilfrid Hodges Logic (Cox & Wyman Ltd, 1982) page 84:

    A one-year-old child is overheard making the following remarks:

        boy. sock. mommy. allgone boy. allgone mommy. byebye sock.

         byebye mommy. boy off. sock off. sock on. mommy on. mommy fall.

Create a grammar that will support the utterances of the child.