Properties of a notation for combining functions
A notation based on pipes in the unixTM operating system is proposed for combining functions in a linear order. Examples suggest that semantic rules using pipes (i.e. the notation) are easy to read and understand, even for readers with little knowledge of semantics. The readability is a consequence of the operational intuition associated with pipes. The operational view is that each function is handed a sequence of values. Generally the sequence is treated as a stack; a function pops zero or more arguments off the stack, pushes zero or more results onto the stack, and passes the stack to the next function. The new idea is that a function may skip over some number of values before picking up its arguments. This approach is suited to expressing the composition of operations on machine states in a programming language. Pipes mesh smoothly with other metalanguage concepts, e.g., lambda abstraction.
The bulk of the paper explores mathematical properties of pipes. In order for pipes to fit into lambda expressions, the arguments of the constructed function has to be well defined. Operationally speaking, we have to keep track of the elements in the stack.
Pipes allow continuation semantics to be written with direct operators: instead of the operator having to worry about its continuation, the second function in a pipe is essentially a continuation of the first. A connection is established between functions connected by pipes and more traditional continuation semantics. This connection is made possible by a combinator do that constructs continuation versions of direct operators, e.g., continuation style operators from the literature for arithmetic, assigning to an identifier, and determining the value of an identifier, can be constructed from their direct counterparts using do. An example of the translation of a pipe based semantic rule for let expressions into a continuation based semantic rule is given.
KeywordsBasic Block Combinatory Logic Function Composition Semantic Rule Direct Operator
Unable to display preview. Download preview PDF.
- bac57.J. W. Backus et al., “The Fortran automatic coding system,” Western joint Computer Conference, pp. 188–198 (1957).Google Scholar
- bjo78.D. Bjomer and C. B. Jones, The Vienna Development Method: The Meta-Language, Lecture Notes in Computer Science 61, Springer Verlag, Berlin (1978).Google Scholar
- bur77.R. M. Burstall, J. S. Collins, and R. J. Popplestone, Programming in POP-2: Revised Edition, Dept. of Artificial Intelligence, Univ. of Edinburgh (1977).Google Scholar
- chu41.A. Church, The calculi of lambda conversion, Annals of Math. Studies, No. 6, Princeton University Press, Princeton NJ (1941).Google Scholar
- mor73.F. L. Morris, “Advice on structuring compilers and proving them correct,” ACM Symposium on Principles of Programming Languages, Boston MA, pp. 144–152 (October 1973).Google Scholar
- mos79.P. D. Mosses, “sis — semantics implementation system: Reference manual and user guide,” DAIMI MD-30, Department of Computer Science, University of Aarhus, Denmark (August 1979).Google Scholar
- mos80.P. D. Mosses, “A constructive approach to compiler correctness,” pp. 449–469 in Automata, Languages and Programming, 7th Colloquium, Noordwijkerhout, Lecture Notes in Computer Science 85, Springer-Verlag, Berlin (July 1980).Google Scholar
- mos81.P. D. Mosses, “A semantic algebra for binding constructs,” pp. 408–418 in Formalization of Programming Concepts, Intl. Colloquium, Peniscola, Spain, Lecture Notes in Computer Science 107, Springer-Verlag, Berlin (April 1981).Google Scholar
- rit80.D. M. Ritchie, “The evolution of the Unix time sharing system,” pp. 25–35 in Proc. Symp. Language Design and Programming Methodology, Sydney, September 1979, ed. J. M. Tobias, Lecture Notes in Computer Science 79, Springer-Verlag, Berlin (1980).Google Scholar
- sch24.M. Schönfinkel, “On the building blocks of mathematical logic,” pp. 355–366 in From Frege to Gödel, ed. J. van Heijenoort, Harvard University Press, Cambridge MA (1967). Written up for publication by H. Behmann in March 1924 under the title, “Uber die Bausteine der mathematischen Logik”.Google Scholar
- set81a.R. Sethi, “Circular expressions: elimination of static environments,” pp. 378–392 in Automata, Languages and Programming, 8th Colloquium, Acre, Lecture Notes in Computer Science 115, Springer-Verlag, Berlin (July 1981). The final version will appear in Science of Computer Programming.Google Scholar
- set81b.R. Sethi, “Control flow aspects of semantics directed compiling,” TR 98, Bell Laboratories, Murray Hill NJ (September 1981). For a summary see SIGPLAN 82: Symposium on Compiler Construction,Boston, (June 1982).Google Scholar
- wan80a.M. Wand, “Deriving target code as a representation of continuation semantics,” TR 94, Computer Science Department, Indiana University, Bloomington IN (July 1980).Google Scholar
- wan80b.M. Wand, “Different advice on structuring compilers and proving them correct,” TR 95, Computer Science Department, Indiana University, Bloomington IN (September 1980).Google Scholar
- wan82.M. Wand, Ninth ACM Symposium on Principles of Programming Languages, Albuquerque NM, pp. 234–241 (January 1982).Google Scholar