MODULE UseStack; (* use the StackOfInteger module *) IMPORT Out, SI := StackOfInteger; (* imports StackOfInteger under the name "SI" *) VAR st : SI.Stack; v, sum : INTEGER; BEGIN st := SI.newStack(); (* create a stack *) SI.push( st, 1 ); (* add some items *) SI.push( st, 23 ); SI.push( st, 456 ); WHILE ~ SI.empty( st ) DO (* unstack, sum and print the items *) v := SI.pop( st ); INC( sum, v ); Out.Int( v, 0 ); IF ~ SI.empty( st ) THEN Out.String( " (" );Out.Int( SI.peek( st ), 0 );Out.String( ")" ) END; Out.Ln END; Out.String( "sum: " );Out.Int( sum, 0 );Out.Ln END UseStack.