CSE 321 Homework 7


  1. Read the Statement section in the 321 class notes where the Statement component is described. Concentrate on the AT/Statement/Kernel.h component where the mathematical model for a Statement is defined, and the kernel operations are specified. For now, you can ignore the Parse and Pretty_Print components.

  2. Given the following BL statements, draw the corresponding abstract syntax tree as defined by the mathematical model of Statement_Kernel.

    1.     IF next-is-empty THEN
              move
          ELSE
              IF next-is-wall THEN
                  turnright
                  turnright
                  move
              END IF
          END IF
    2.     WHILE true DO
              turnright
              IF next-is-enemy THEN
                 TurnAround
              ELSE
                 skip
              END IF
              turnleft
          END WHILE
  3. Explain clearly in English what the initial value of a Statement object is.