No Title CS302 Spr'99 Lecture Notes Lecture 7 Uses of Boolean Expressions Used to drive conditional execution of program sections. Encode true and false numerically, e.g., as 1 and 0, and treat boolean expressions like arithmetic expressions. Language may support boolean values. Position in generated code represents boolean value. Convenient for control statements.
Relational expressions perform test and jump to true or false exit accordingly.
Boolean variables and constants jump directly to appropriate true or false exit. Conditional statements define true and false exits of boolean sub-expression to point to appropriate code blocks, e.g., THEN and ELSE branches. If boolean-typed expression must deliver a value, true and false exits are defined to point to code that loads the value. Relational Expressions Inherit true and false label attributes. Synthesize code to perform appropriate test and jump to appropriate label.