A While Language

While-Language is a little language we use in lectures to illustrate basic concepts.

The exact definition of what is contained in that language will sometimes vary depending on the specific points we want to illustrate, but a possible concrete syntax is given here.

  • 'while' because it has 'while' and 'if' as the only control statements (e.g. no procedures)
  • in exercises you work with the slightly more complex tool language

State of While Language:

  • finite set of integer variables (integer is the only type)
  • variables not declarated, initialized to 0 on first use

Example While Programs:

Syntax: describes the set of well-formed programs

  • usually, without subtleties such as types and rules that e.g. each variable much be declared
  • approximation of meaningful programs