ICALP 1982: Automata, Languages and Programming pp 429-441

# Properties of a notation for combining functions

• Jean -Claude Raoult
• Ravi Sethi
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 140)

## Abstract

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.

## Keywords

Basic Block Combinatory Logic Function Composition Semantic Rule Direct Operator
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

## References

1. abd76.
S. K. Abdali, “An abstraction algorithm for combinatory logic,” J. Symbolic Logic 41(1), pp. 222–224 (March 1976).
2. bac57.
J. W. Backus et al., “The Fortran automatic coding system,” Western joint Computer Conference, pp. 188–198 (1957).Google Scholar
3. 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
4. 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
5. chu41.
A. Church, The calculi of lambda conversion, Annals of Math. Studies, No. 6, Princeton University Press, Princeton NJ (1941).Google Scholar
6. cur58.
H. B. Curry and R. Feys, Combinatory Logic, North-Holland, Amsterdam (1958).
7. gor79.
M. J. C. Gordon, The Denotational Description of Programming Languages, Springer-Verlag, New York NY (1979).
8. 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
9. 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
10. 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
11. 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
12. 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
13. 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
14. 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
15. 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
16. tha81.
J. W. Thatcher, E. G. Wagner, and J. B. Wright, “More on advice on structuring compilers and proving them correct,” Theoretical Computer Science 15, pp. 223–249 (1981).
17. tur79.
D. A. Turner, “A new implementation technique for applicative languages,” Software — Practice and Experience 9(1), pp. 31–49 (January 1979).
18. 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
19. 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
20. wan82.
M. Wand, Ninth ACM Symposium on Principles of Programming Languages, Albuquerque NM, pp. 234–241 (January 1982).Google Scholar