Stroustrup's PPP using C++: chapter 7, section 7 ("Recovering from errors")
<p><strong>Edit:</strong> there's nothing wrong with the book, I simply failed to properly copy the code provided in it. The <code>try-catch</code> block is supposed to be inside the while loop while I've put it outside of it.</p>

<hr>

<p>There is something I may be missing about Stroutrup's "Programming: Principles and Practice using C++", at chapter 7, section 7 ("Recovering from errors"). I hope someone who read this book will be able to help me (or anyone, actually!).</p>

<p>We have developed a calculator with a token parser. When the program reads an invalid token, it just terminates. Section 7' objective is to make the calculator recover from such errors without terminating. My problem is that after following the book's directives, the calculator still terminates after an invalid token.</p>

<p><a href="http://pastebin.com/LfCVSYeg" rel="nofollow">Here</a> is the complete code of the calculator. <a href="http://pastebin.com/DkAqF5Gf" rel="nofollow">Here</a> is std_lib_facilities.h, in case you need it to understand the code.</p>

<p>As you can see, <code>main()</code> calls for <code>calculate()</code>, which in turn calls for <code>clean_up_mess()</code> if an exception is thrown (which happens when a invalid token is read). <code>clean_up_mess()</code> then removes everything from the Token_stream until the <em>print</em> char (';') is found, so we can go on with the next calculation, which will hopefully not contain another invalid token.</p>

<p>But after the exception handling is done, the program simply terminates. What do I need to do for it to resume where the exception was thrown? And did the author forget to explain this, or did I miss something?</p>

<p>Thanks.</p>
