The While programming language ============================== The While programming language is defined by the following grammar. P --> input I; P | Q; output E | output E Q --> S | S; Q I --> x | y | z | ... S --> accept | reject | skip | I := E | if B then S else S | while B do S | begin Q end E --> T | E + T | E - T T --> F | T * F | T / F F --> I | ( E ) | 0 | 1 | 2 | ... B --> not B | E < E | E = E | E > E Semantics: Every While program mentions a finite number of variables. At the beginning of the program, all of those variables are zero except for the input variable, whose value is the input to the program. The program accepts the input if and only if it executes an accept statement or an output statement, and rejects the input if and only if it executes a reject statement; all three of those statements terminate the program. If the program never terminates, it is said to loop.