Part 1 is a family tree program. Part 2 is a simple grammar program which will tell you whether a sentence follows the specified grammar or not.