Listing 1: A high-level algorithm for xr

Starting with an empty cross-reference table and the current line number at one, repeatedly get tokens until there are no more. For each token:

After reading the entire input, print the alphabetized cross-reference listing, one word per output line.