Using Functor Categories to Generate Intermediate Code

  • John C. Reynolds
Part of the Progress in Theoretical Computer Science book series (PTCS)

Abstract

In the early 80’s Oles and Reynolds devised a semantic model of Algol-like languages using a category of functors from a category of store shapes to the category of predomains. Here we will show how a variant of this idea can be used to define the translation of an Algol-like language to intermediate code in a uniform way that avoids unnecessary temporary variables, provides control-flow translation of boolean expressions, permits online expansion of procedures, and minimizes the storage overhead of calls of closed procedures. The basic idea is to replace continuations by instruction sequences and store shapes by descriptions of the structure of the run-time stack.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [1]
    Jones, N. D. and Schmidt, D. A. Compiler generation from denotational semantics. In Semantics-Directed Compiler Generation, Proceedings of a Workshop, Aarhus, Denmark, January 14–18, edited by N. D. Jones. Lecture Notes in Computer Science, vol. 94, Springer-Verlag, Berlin, 1980, pp. 70–93.Google Scholar
  2. [2]
    Steele Jr., G. L. RABBIT: A Compiler for SCHEME (A Study in Compiler Optimization). Report no. AI-TR-474, Massachusetts Institute of Technology, Artificial Intelligence Laboratory, May 1978, iii+272 pp.Google Scholar
  3. [3]
    Wand, M. Deriving target code as a representation of continuation semantics. ACM Transactions on Programming Languages and Systems, vol. 4 (1982), pp. 496–517.MATHCrossRefGoogle Scholar
  4. [4]
    Reynolds, J. C. The essence of ALGOL In Algorithmic Languages,Proceedings of the International Symposium on Algorithmic Languages, Amsterdam, October 26–29, edited by J. W. de Bakker and J. C. van Vliet. North-Holland, Amsterdam, 1981, pp. 345–372. See Chapter 3.Google Scholar
  5. [5]
    Oles, F. J. A Category-Theoretic Approach to the Semantics of Programming Languages,Ph. D. Dissertation. Syracuse University, August 1982, vi+240 pp. See Chapter 11.Google Scholar
  6. [6]
    Oles, F. J. Type algebras, functor categories, and block structure. In Algebraic Methods in Semantics,edited by M. Nivat and J. C. Reynolds. Cambridge University Press, Cambridge, England, 1985, pp. 543–573. See Chapter 11.Google Scholar
  7. [7]
    Morris, F. L. Correctness of Translations of Programming Languages—An Algebraic Approach, Ph. D. Dissertation. Stanford University, August 1972.Google Scholar
  8. [8]
    Reynolds, J. C. Conjunctive types and ALGOL-like languages (abstract of invited lecture). In Proceedings Symposium on Logic in Computer Science, Ithaca, New York, June 22–25. 1987, p. 119.Google Scholar
  9. [9]
    Reynolds, J. C. Preliminary Design of the Programming Language FORSYTHE. Report no. CMU-CS-88–159, Carnegie Mellon University, Computer Science Department, June 21, 1988. See Chapter 8.Google Scholar
  10. [10]
    Reynolds, J. C. The coherence of languages with intersection types. In Theoretical Aspects of Computer Software,International Conference TACS ‘91, Proceedings, Sendai, Japan, September 24–27, 1991, edited by T. Ito and A. R. Meyer. Lecture Notes in Computer Science, vol. 526, Springer-Verlag, Berlin, 1991, pp. 675–700.Google Scholar
  11. [11]
    Scott, D. S. The lattice of flow diagrams. In Symposium on Semantics of Algorithmic Languages, edited by E. Engeler. Lecture Notes in Mathematics, vol. 188, Springer-Verlag, Berlin, 1971, pp. 311–366.Google Scholar
  12. [12]
    Goguen, J. A., Thatcher, J. W., Wagner, E. G., and Wright, J. B. Initial algebra semantics and continuous algebras. Journal of the ACM, vol. 24 (1977), pp. 6895.MathSciNetCrossRefGoogle Scholar
  13. [13]
    Dijkstra, E. W. Recursive programming. Numerische Mathematik, vol. 2 (1960), pp. 312–318.MathSciNetMATHCrossRefGoogle Scholar
  14. [14]
    Naur, P. The design of the GIER ALGOL compiler, part I. BIT, vol. 3 (1963), pp. 124140. Reprinted in Goodman, Richard, editor, Annual Review in Automatic Programming, Vol. 4, Pergamon Press, Oxford (1964) 49–85.Google Scholar

Copyright information

© Springer Science+Business Media New York 1997

Authors and Affiliations

  • John C. Reynolds

There are no affiliations available

Personalised recommendations