Answer to Exercise 20

| ANSWER TO EXERCISE 20
| There are several ways to do this. The easiest is to add more grammar to the parser and let it do the hard work:
    Object -> computer "computer"
      with name "computer",
           orders
           [;  Theta: print_ret "~Theta now set to ", noun, ".~";
               default: print_ret "~Please rephrase.~";
           ],
      has  talkable;
    ...
    [ ThetaSub; "You must tell your computer so."; ];
    Verb "theta" * "is" number -> Theta;

Back to the exercise in section 16

Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.