Project 2: Separation of Concerns - Scanning for next token - Classifying a token For bad lexemes, consider: BADSYM, BADID, BADNUM Get next TOKEN may benefit from the Look_Ahead() function. This project identifies lexemes only. We worry about the grammar in Project 3. Read(x) is four tokens, and that's also four lexemes, READSYM, LPAREN, IDENT, RPAREN BUT, Read(x(y is five lexemes, READSYM, LPAREN, IDENT, LPAREN, IDENT The 2nd example causes no error in Project 2. ========================================== L-values vs. R-values C++ allows cascading = operators, e.g. i = j = 23; . Suppose C++ did not permit this. Then all applications of = would be = In C++, the assignment i = j involves two l values, because of the possibility that it could have been i = j = 23 The lhs of an assignment stmnt always provides a reference to memory, and the assignment locks the value assigned into the memory location represented by the lhs. The lhs is ALWAYS an l-value, because an l-value is a changeable memory location. In C++, an l-value need not be changed, but it CAN be changed, i.e. assigned to. An r-value can only have its value accessed. It cant't be changed. ------------------------------------------------- Type Conversion/Coercion e.g. In C++ char c = 321; // 'A' Assigns to c the character represented by 321 % 256 Implicit coercion: Assign int to double Assign real to int? Truncate, maybe type cast