Suppose I have the following CFG rules:

S -> NP VP
NP -> (D) NOM
VP -> V (NP) (NP)
NOM -> N
PP -> P NP
X -> X+ CONJ X

How should I draw the tree diagram of this sentence?

Most cats and dogs with fleas live in the neighbourhood.

As I understand it, the sentence has two different interpretations, with one attributing fleas to both cats and dogs and the other only to dogs.

For the case of attributing fleas to only dogs I drew the following diagram:

enter image description here

Now for the second interpretation, I figured I should add the NOM substructure to the first NOM before CONJ:

enter image description here

This seems to be correct to me, because it reflects the fact that the attribute is equally applicable to both NOMs. But on the other hand, I am writing words on the added branch that aren't there (have been deleted for avoiding repetition) and the tree reads a longer sentence.

Is my parsing correct and if not how should I make it work right?

  • What is the definition of a tree diagram. I know of parse trees, corresponding to the analysis of a sentence according to the rules of a grammar and I can tell you about that. But I do not know what you call tree diagrams, and hence I cannot tell how to get them from parse trees... Unless you provide the definition.
    – babou
    Commented Dec 3, 2014 at 23:04
  • The rule X -> X+ CONJ X is not a standard CF rule, for 2 reasons. I guess the + means arbitrary repetition with at least one occurrence. Also I suppose it is actually a rule schema, where X stands for any non-terminal, but the same for a whole rule instance (which may produce some strange sentences if you replace X by CONJ). Am I correct?
    – babou
    Commented Dec 3, 2014 at 23:13
  • Why do you have a rule NOM -> N, but N does not appear in your trees?
    – babou
    Commented Dec 3, 2014 at 23:18
  • This is probably not a standard CFG rule, right. It is taken from an example in the first chapters of a book on HPSG theory by Ivan Sag, where the author is still explaining how CFG's work before starting to really define HPSG itself. + is indeed a Kleene plus and yes I should have added N to the last branches of both diagrams, I simply forgot that.
    – Omid
    Commented Dec 4, 2014 at 0:37
  • Thanks. And what are tree diagrams? Are they supposed to be parse trees?
    – babou
    Commented Dec 4, 2014 at 0:39

1 Answer 1


If you are looking for parse trees according to your grammar, the first tree seems correct, up to the missing N symbols, and a missing NOM above fleas.

However your second diagram should look as follow, drawing only the relevant part that changes (i.e. under NOM_1):

            NOM 1
         __/   \___
        /          \
     NOM            PP
    / | \_         /  \
   /  |   \       |    |
 |     |    |     |    |
 N    and   N   with  NOM
 |          |          |
cats       dogs        N

Now, If you wanted to draw both trees in a single diagram, that is possible, but significantly more complicated. But I doubt your book does anything of the kind.

Not the answer you're looking for? Browse other questions tagged or ask your own question.