<code>input^ = '$'</code> is old-school ANSI pascal. input^ has the next character, before the next read. So, you can do a check of the next character, before you actually read it. You have to compile it with the option -Miso and probably the SVN version from trunk. I think that it is not working in plain 3.0.0. On OS X, the version 3.0.0.1 from fink compiles it and the program seems to work.