CSE 111, Fall 2000

Great Ideas in Computer Science

Lecture Notes #4

(5.  Insight III    (Boehm & Jacopini's Theorem),
      continued)

Using flowcharts, the 3 rules of grammar
(which are sometimes also called "control structures")
can be illustrated like this:

    (Note:  It's too hard to draw flowcharts for a webpage,
      so I won't even try, but hopefully what I show below will
      give you the flavor of it.  If anyone wants to volunteer to
      give me some neat flowcharts I can include in this webpage,
      please let me know :-)

sequence (first do this; then do that):

    S1 ; S2

|
|
V
S1
|
|
V
S2
|
|
V
choice (or selection)
    (IF some statement Q is true,
        THEN do this
        ELSE do that)

    IF Q
        THEN S1
        ELSE S2
 

|
|
V
(else if false)          (if true)
--------------- Q? ---------------
|                                |
|                                |
V                                V
S2
 
S1
|                                |
|                                |
V                                V


repetition (or looping)
    (WHILE some statement Q is true, DO this)

    WHILE Q DO
        S

These, together with naming, are the 4 basic features of Pascal and Karel the Robot that we'll learn.


Copyright © 2000 by William J. Rapaport (rapaport@cse.buffalo.edu)

file: 111F00/lecturenotes4.14sp00.html