Check your term marks. If there is an error, please send me email immediately.
The error occurs when input such as:
1 + 2 * 3 ^ 4 - 5
is given. It is wrongly interpreted as:
1 + ( 2 * ( ( 3 ^ 4 ) - 5 ) ) = 153
when of course it should be:
(1 + ( 2 * ( 3 ^ 4 ) ) ) - 5 = 158
The problem is when the - is seen, it only did a bind to the
top of the stack operator (the 3 ^ 4). It should not stop
there, it should continue binding as long as the top stack
operator has priority >= priority of -. Thus, the 'if'
comparing priorities should be changed to a 'while'.
Cay Horstmann,
Computing Concepts with Java Essentials,
Wiley, 1998.
Walter Savitch,Good for C/C++ programmers:
Java: An Introduction to Computer Science and Programming,
Prentice Hall, 1999.
David Flanagan,For programmers who want more information about the class libraries that come with Java:
Java in a Nutshell, 2nd Edition,
O'Reilly, 1998.
Note: this is based on JDK1.1. There may soon be a 3rd Edition based on JDK1.2.
Patrick Chan, Rosanna Lee, and Douglas Kramer,
The Java Class Libraries, Second Edition, Volumes 1 and 2,
Addison-Wesley, 1998.
Warning: each volume is about 2000 pages!