9.6 Exercises

  1. Download leftrec.pl, the left-recursive grammar that we already saw in the previous section. Can the left-corner recognizer cope with it? Why does it not have the same problems with it as the top-down algorithm?

  2. Now, download epsilon.pl, the grammar with the empty production that we already saw in the chapter in bottom-up recognition. Write a left-corner table for it. (Note: \epsilon is a kind of terminal symbol.) Now, change leftcorner_recognizer_table.pl so that you can use it with epsilon.pl. Next, compare how leftcorner_recognizer_table.pl, the left-corner recognizer using left-corner tables, and leftcorner_recognizer.pl, the left-corner recognizer not using left-corner tables, behave when working with grammar epsilon.pl.

  3. Turn the left-corner recognizer into a parser by adding an extra argument to collect the structure.

  4. Extend ourEng.pl so that it accepts coordination of noun phrases. It should e.g. accept the man and the woman danced or marsellus and mia and the robber laughed. Could your grammar also be processed by a top-down or a bottom-up recognizer?

Patrick Blackburn and Kristina Striegnitz
Version 1.2.4 (20020829)