This Article 
 Bibliographic References 
 Add to: 
Programming with Streams in a Pascal-Like Language
January 1991 (vol. 17 no. 1)
pp. 1-9

A description is given of features which were added to a conventional programming language that will manipulate streams of values. A stream is a sequence of values of a certain fixed type. The number of elements of a stream may be determined at execution time, and evaluation of each element can be postponed until its value is actually needed. Many programs can be expressed naturally and clearly as networks of processes communicating by means of streams. The network is called a composite function and consists of several component functions. Since component functions are connected solely by streams, they greatly increase the flexibility of combinations and the reusability of programs. Loop statements can be considered as iterative statements over streams. One general problem in these networks is the mechanism of terminating each process of the network. A practical solution for this problem is presented. Comparisons to other programming styles, such as coroutines, Lisp, functional programming, and dataflow languages, are described. Three modes of execution are considered for the implementation of composite functions: parallel mode, coroutine mode, and inline mode. In the inline mode, a composite function is expanded and transformed into a single function, realizing maximum run-time efficiency. Algorithms for this expansion are given.

[1] M. A. Jackson, "Information systems: Modeling, sequencing and transformations." inProc. 3rd Int. Conf. Software Engineering, 1978, pp. 72-81.
[2] K. Iwamoto and O. Shigo, "Unifying data flow and control flow based modularization techniques," inProc. COMPCON '81, 1981, pp. 271-277.
[3] W. P. Stevens, "How data flow can improve application development productivity,"IBM Syst. J., vol. 21, no. 2, pp. 162-178, 1982.
[4] M. A. Jackson,Principles of Program Design.New York: Academic, 1975.
[5] J. M. Triance and J.F.S. Yow, "Experiences with a schematic logic preprocessor,"Software-Practice and Experience, vol. 10, pp. 791-800, 1980.
[6] D. M. Ritchie and K. Thompson, "The UNIX time-sharing system,"Commun. ACM, vol. 17, pp. 365-375, July 1974.
[7] W. Teitelman and L. Masinter, "The Interlisp programming environment,"Computer, vol. 14, pp. 25-33, Apr. 1981.
[8] W. H. Burge, "Stream processing functions,"IBM J. Res. Develop., vol. 19, pp. 12-25, 1975.
[9] J. Backus, "Can programming be liberated from the von Neumann style? A functional style and its algebra of programs,"Commun. ACM, vol. 21, no. 8, pp. 613-641, Aug. 1978.
[10] D. A. Turner, "Recursion equations as a programming language,"Functional Programming and its Applications, J. Darlington,et al., Eds. Cambridge, England: Cambridge University Press, 1982, pp. 1-28.
[11] T. Ida and J. Tanaka, "Functional programming with streams," inInform. Processing 83.Amsterdam, The Netherlands: North-Holland, 1983.
[12] Arvind, K. P. Gostelow, and W. Plouffe, "An asynchronous programming language and computing machine," Univ. California, Irvine, Tech. Rep.TR-114a, 1978.
[13] J. B. Dennis and K. K.-S. Weng, "An abstract implementation for concurrent computation with streams," inProc. 1979 Int. Conf. Parallel Processing, 1979, pp. 35-45.
[14] K. E. Iverson, "Notation as a tool of thought,"Commun. ACM,vol. 28, pp. 444-465, Aug. 1980.
[15] R. E. Griswold, D. R. Hanson, and J. T. Korb, "Generators in icon,"ACM Trans. Program. Lang. Syst.,vol. 3, pp. 144-161, Apr. 1981.
[16] G. Kahn and D. B. MacQueen, "Coroutines and networks of parallel processes," inInformation Processing 77. Amsterdam, The Netherlands: North-Holland, 1977, pp. 993-998.
[17] E. A. Ashcroft and W. W. Wadge, "Lucid, a non-procedural language with iteration,"Commun. ACM, vol. 20, pp. 519-526, July 1977.
[18] P. Henderson and J. H. Morris, "A lazy evaluator," inProc. 3rd POPL Symp., 1976, pp. 95-103.
[19] Arvind and J. D. Brock,Streams and Managers (Lecture Notes in Computer Science, vol. 143). New York: Springer-Verlag, 1978, pp. 452-465.
[20] B. Liskovet al., "Abstraction mechanisms in CLU,"Commun. ACM, vol. 20, pp. 564-576, Aug. 1977.
[21] M. Shaw, W. A. Wulf, and L. London, "Abstraction and verification in Alphard: Defining and specifying iteration and generators."Commun. ACM, vol. 20, pp. 553-564, Aug. 1977.
[22] I. Nakata, "Compiling algorithms for logical expressions."Joho-Shori (J. Inform. Processing Soc. Japan), vol. 16, no. 3, pp. 186-194, 1975 (in Japanese).
[23] INMOS Ltd.,Occam Programming Manual. Englewood Cliffs, NJ: Prentice-Hall, 1984.
[24] C. A. R. Hoare, "Communicating sequential processes,"Commun. ACM, vol. 21, pp. 666-677, 1978.
[25] P. Henderson,Functional Programming: Application and Implementation. Englewood Cliffs, NJ: Prentice-Hall, 1980.
[26] Reference Manual for the Ada Programming Languages, U.S. Dep. Defense, July 1982.
[27] L. I. Vanek and R. Marty, "Hierarchical coroutines: A mechanism for improved program snucture," inProc. 4th Int. Conf Software Eng., vol. SE-5, pp. 274-285, 1979.
[28] D. J. Dahl and R. Nygaard,Simula 67 Common Base Language, Norwegian Computing Center Publ. S-2, 1968.
[29] C. D. Marlin,Coroutines (Lecture Notes in Computer Science, vol. 95). New York: Springer-Verlag, 1980.
[30] J. Kriz and H. Sandmayr, "Extension of Pascal by coroutines and its application to quasi-parallel programming and simulation,"Software-Practice and Experience, vol. 10, pp. 773-789, 1980.
[31] K. Moody and M. Richards, "A coroutine mechanism for BCPL,"Software-Practice and Experience, vol. 10, pp. 765-771, 1980.
[32] F. Cristian, "Exception handling and software fault tolerance,"IEEE Trans. Comput.,vol. C-31, pp. 531-539, June 1982.
[33] F. Cristian, "Robust data types,"Acta Inform., vol. 17, pp. 365- 397, 1982.
[34] I. Nakata and M. Sassa, "Programming with streams," IBM Res. Rep. RJ 3751, 1983.
[35] R. C. Waters, "A method for analyzing loop programs,"IEEE Trans. Software Eng., vol. SE-5, pp. 237-247, May 1979.
[36] P. Wadler, "Applicative style programming, program transformation, and list operators," inProc. Functional Programming Languages and Computer Architecture, 1981, pp. 25-32.
[37] T. Hagino, "Proofs of communicating sequential processes, Preprint of WGSF Meeting (WG on Software Foundation), Inform. Processing Soc. Japan, Oct. 1982 (in Japanese).
[38] Y. Miyashita and O. Shigo, "A method to translate concurrent programs into sequential programs," inProc. 21st IPSJ Nat. Conf., 1979 (in Japanese).
[39] K. Kuse, M. Sassa, and I. Nakata, "Modelling and analysis of concurrent processes connected by streams,"J. Inform. Processing, vol. 9, pp. 148-158, 1986.
[40] M. Satoet al., "Pseudo parallel execution of stream functions," inProc. 26th IPSJ Nat. Conf., 1983 (in Japanese).

Index Terms:
loop statements; streams; Pascal-like language; fixed type; composite function; component functions; combinations; reusability; iterative statements; programming styles; coroutines; Lisp; functional programming; dataflow languages; parallel mode; coroutine mode; inline mode; programming
I. Nakata, M. Sassa, "Programming with Streams in a Pascal-Like Language," IEEE Transactions on Software Engineering, vol. 17, no. 1, pp. 1-9, Jan. 1991, doi:10.1109/32.67573
Usage of this product signifies your acceptance of the Terms of Use.