The following will be discussed in this chapter: Introduction to LR parsing, why LR parsers? items and the LR(0) automaton, the LR-parsing algorithm, constructing SLR-parsing tables, viable prefixes, powerful LR parsers, canonical LR(l) Items, constructing LR(l) sets of items, canonical LR(l) parsing tables, constructing LALR parsing tables, efficient construction of LALR parsing tables, compaction of LR parsing tables. | LESSON 21 Overview of Previous Lesson(s) Over View 3 Local tab The Locals tab shows the values of the variables local to the current function. Auto Tab Shows the automatic variables in use in the current statement and its immediate predecessor. Threads Tab Allows to inspect and control threads in advanced applications Over View 4 Modules Tab Lists details of the code modules currently executing. Watch1 Tab Variables can be added to the Watch1 tab that we want to watch. Over View Customized debugging code is aimed at highlighting bugs wherever possible and providing tracking output to helping the programmer to pin down the bugs. 5 Over View. This overhead is not needed in the final version. So this code only operates in the debug version of a program, not in the release version. The output produced by debug code provide clues as to what is causing a problem. 6 Over View Using preprocessor directives, a programmer can add any code to the program. Preprocessor symbol, DEBUG, is always defined automatically in Visual C++ in the debug version of a program, but is not defined in the release version. Debugging code is enclosed between a preprocessor #ifdef / #endif pair of directives. 7 Over View Program Name: cdebug Header Files Source Files 8 TODAY’S LESSON 9 Contents Customized Debugging Code Debugging a program Extending the Class Testing the extending Class Finding the next Bug 10 Extending Class Based on the output, everything is working last time. It’s time to add the definitions for the overloaded comparison operators to the Name class. We are now implementing the comparison operators for Name objects. 11 Extending Class // Less than operator bool Name::operator (const Name & name) const { return name > *this; } 13 Extending Class // Equal to operator bool Name::operator==(const Name & name) const { if(strcmp(pSurname, ) == 0 && strcmp(pFirstname, ) == 0) return true; else return false; } 14 Extending Class Now we can extend the test program by creating an array of Name objects. Initializing them in some arbitrary way. Comparing the elements of the array using comparison operators for a Name object. 15 Find the Next Bug The Build output includes the following message: warning C4717: 'Name::operator >' : recursive on all control paths, function will cause runtime stack overflow The message box indicates you have exceeded the capacity of the stack memory available. There are successive calls of the operator > () function so it must be calling itself, as the missed message said it would. 16 Thank You 17