dn- - dn- - (dn- dn- assume now that the sequence is to be read and transformedand the resulting numeric value to be assigned to the simple algorithm terminates with the reading of the first character that is not digit (arithmetic overflow is not consideredx : read(ch)(adens charstonumber *while (" <ch(ch <" "do : * (ord(chord(" "))read(chend in the case of output the transformation is complexified by the fact that the decomposition of into decimal digits yields them in the reverse order the least digit is generated first by computing mod this requires an intermediate buffer in the form of first-in-last-out queue (stackwe represent it as an array with index and obtain the following programi : (adens numbertochars *repeat [ : mod : div inc(iuntil repeat dec( )write(chr( [iord(" "))until note consistent substitution of the constant in these algorithms by positive integer will yield number conversion routines to and from representations with base frequently used case is (hexadecimal)because the involved multiplications and divisions can be implemented by simple shifts of the binary numbers obviouslyit should not be necessary to specify these ubiquitous operations in every program in full detail we therefore postulate utility module that provides the most commonstandard input and output operations on numbers and strings this module is referenced in most programs throughout this bookand we call it texts it defines type textreaders and writers for text sand procedures for reading and writing characteran integera cardinal numberor string before we present the definition of module textswe point out an essential asymmetry between input and output of texts whereas text is generated by sequence of calls of writing procedureswriting integersreal numbersstrings etc reading text by sequence of calls of reading procedures is questionable practice this is because we rather wish to read the next element without having to know its type we rather wish to determine its type after reading the item this leads us to the concept of scanner whichafter each scan allows to inspect type and value of the item read scanner acts like rider in the case of files howeverit imposes certain syntax on the text to be read we postulate scanner for texts consisting of sequence of integersreal numbersstringsnamesand special characters given by the following syntax specified in ebnf (extended backus naur form)item integer realnumber identifier string specialchar integer ["-"digit {digitrealnumber ["-"digit {digitdigit {digit[(" " ")["+"-digit {digit}identifier letter {letter digitstring '"{any character except quote'"specialchar "!"?"@"#"$"%"^"&"+"-"*"/"\"|"(")"["]"{"}