.Open CS320/08 Expressions and Assignment Statements .Table .Row Prev .See ./07.html .Item Data Types .Item Chapter 6 .Item lab07 C/C++ Data .Row 08 Expressions etc Chapter 7 lab08 C/C++ Expressions .Row Next .See ./09.html .Item Control structures .Item Chapter 8 not section 5 .Item lab09 C/C++ Control .Close.Table . Preparation Study chapter 7. This chapter is about expressions and assignments. See the UML diagram. .Image 08/ole.gif Expressions and Assignments Answer review questions on chapter 7. Hand in answers to 2 or more review questions. . Note 1: Expressions are not Statements Be careful to distinguish Expressions from Statements. Expressions are evaluated and return Values. Statements are executed and return a new State. Most languages have both. . Note 2: Precedence and Associativity You may want to express precedence and associativity in your project. These are syntax not semantics. Express precedence and associativity in BNF/EBNF/XBNF not in the UML. It takes some extra definitions. See sections 3.3.1.7, 3.3.1.8 and 3.3.1.9 in the book. For example, suppose we might define expression::= simple_expression #( operator simple_expression), operator::= "+" | "*". But this does not show the relative precedence of "+" and "*". We show the precedence of "*" and "+" in algebra by replacing the above by: expression::= term #( "+" term), term::= simple_expression #( "*" simple_expression). To express associativity we can replace the '#' by recursion. For example: expression::= term | expression "+" term, -- left associative. term::= simple_expression| simple_expression "*" term, -- right associative. Warning: it is unusual(and confusing) to have different associativities for multiplication and addition in a real language. .Close . Class Work .See ./08q.html . Lab Work .See ./lab/08.html . Next .See ./09.html