Using Functor Categories to Generate Intermediate Code
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.
KeywordsFunctor Category Simple Type Boolean Expression Instruction Sequence Type Assignment
Unable to display preview. Download preview PDF.
- 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
- 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
- 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
- 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
- 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
- Morris, F. L. Correctness of Translations of Programming Languages—An Algebraic Approach, Ph. D. Dissertation. Stanford University, August 1972.Google Scholar
- 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
- 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
- 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
- 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
- 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