Extending Bill's Vocabulary

Bill's vocabulary can be extended to include new words. However, these words are constructed from the set of primitive words. For example, a turnright instruction can be introduced as a set of three turnleft instructions. Because the turnright instruction comprises multiple primitive turnleft instructions, it must be defined as a block of turnleft instructions. The following is a sample structure of a program:


BEGINNING-OF-PROGRAM
               DEFINE-NEW-INSTRUCTION turnright AS
                    BEGIN
                         turnleft;
                         turnleft;      
                         turnleft;
                    END
               BEGINNING-OF-EXECUTION
                    move;
                    turnleft;
                    move;
                    turnright;
                    pickbeeper;
                    turnoff;
               END-OF-EXECUTION
END-OF-PROGRAM 




Back to Previous Page

Document:
Local Date:
Last Modified On: