Compiler generation from relational semantics

  • Mads Dam
  • Frank Jensen
Part of the Lecture Notes in Computer Science book series (LNCS, volume 213)


We consider the problem of automatically deriving correct compilers from relational semantic specifications of programming languages. A relational semantics is an assignment of initial-state final-state relations (defined by means of proof rules) to programs. Compilers are generated in three steps. First, the language definition is transformed into a stack semantics in which the storage of semantic values is made explicit. Next, stack rules are assembled into a socalled language scheme containing exactly one rule for each language construct. We consider languages for which non-deterministic branches may be replaced by deterministic ones. Finally, rules are expanded for the purpose of recursion detection, thus obtaining schemes which may be used for code generation in a syntax-directed compiler.


Relational Semantic Operational Semantic Program Variable Denotational Semantic Proof Tree 
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.


  1. [ADJ 78]
    J.A. Goguen, J.W. Thatcher, E.G. Wagner: An Initial Algebra Approach to the Specification, Correctness, and Implementation of Abstract Data Types. In: Current Trends in Programming Methodology, Vol. IV, R.T. Yeh (editor), Prentice-Hall 1978.Google Scholar
  2. [Bjørner 77]
    D. Bjørner: Formal Development of Interpreters and Compilers, DtH ID673, 1977.Google Scholar
  3. [De Bakker/De Roever 72]
    J.W. De Bakker, W.P. De Roever: A Calculus for Recursive Program Schemes. In: Automata, Languages, Programming, Nivat (editor), North-Holland, Amsterdam 1972.Google Scholar
  4. [Ganzinger 80]
    H. Ganzinger: Transforming Denotational Semantics into practical Attribute Grammars. In: Semantics-Directed Compiler Generation, LNCS 94, N.D. Jones (editor), 1980.Google Scholar
  5. [Gordon 79]
    M.J.C. Gordon: The Denotational Description of Programming Languages — An Introduction, Springer-Verlag 1979.Google Scholar
  6. [Greif/Meyer 81]
    I.Greif, A.R. Meyer: Specifying the Semantics of while Programs: A Tutorial and Critique of a Paper by Hoare and Lauer, ACM Transactions on Programming Languages and Systems, Vol. 3, No. 4, Oct. 1981.Google Scholar
  7. [Hoare/Lauer 73]
    C.A.R. Hoare, P.E. Lauer: Consistent and Complementary Formal Theories of the Semantics of Programming Languages, Acta Informatica 3, 1974.Google Scholar
  8. [Jensen/Dam 85]
    F. Jensen, M. Dam: Automatisk generering af oversœttere udfra operationelt semantiske definitioner af programmeringssprog, M.Sc. Thesis (in danish), Aalborg University Centre, 1985.Google Scholar
  9. [Jones/Christiansen81]
    N.D. Jones, H. Christiansen: Control Flow Treatment in a Simple Semantics-Directed Compiler Generator, DAIMI PB-137, sept. 1981.Google Scholar
  10. [Jones/Schmidt 80]
    N.D. Jones, D.A. Schmidt: Compiler Generation from Denotational Semantics. In: Semantics-Directed Compiler Generation, LNCS 94, N.D. Jones (editor), 1980.Google Scholar
  11. [Kowalski 74]
    R. Kowalski: Predicate Logic as Programming Language. In: Information Processing 74, North-Holland 1974.Google Scholar
  12. [Milne/Strachey 76]
    R. Milne, C. Strachey: A Theory of Programming Language Semantics, Chapman and Hall, 1976.Google Scholar
  13. [Morris 73]
    F.L. Morris: Advice on Structuring Compilers and Proving Them Correct, Proc. 2nd ACM Symp. on Principles of Prog. Lan., 1973.Google Scholar
  14. [Mosses 79]
    P. Mosses: SIS-Semantics Implementation System, Reference Manual and User's Guide, DAIMI MD-30, 1979.Google Scholar
  15. [Mosses 80]
    P. Mosses: A Constructive Approach to Compiler Correctness. In: Semantics-Directed Compiler Generation, LNCS 94, N.D. Jones (editor), 1980.Google Scholar
  16. [Nielson 84]
    H.R. Nielson: Hoare Logic's for Run-time Analysis of Programs, Ph.D. Thesis, University of Edinburgh, oct. 1984.Google Scholar
  17. [Nielson/Nielson85]
    F. Nielson, H.R. Nielson: Pragmatic Aspects of Two-Level Denotational Meta-Languages, AUC R-85-13.Google Scholar
  18. [Plotkin 81]
    G.D. Plotkin: A Structural Approach to Operational Semantics, DAIMI FN-19, sept. 1981.Google Scholar
  19. [Schmidt 85]
    D.A. Schmidt: Detecting Global Variables in Denotational Specifications, ACM Transactions on Programming Languages and Systems, Vol. 7, No. 2, april 1985.Google Scholar
  20. [Sethi 83]
    R. Sethi: Control-Flow Aspects of Semantics-Directed Compiling, ACM Transactions on Programming Languages and Systems, Vol. 5, No. 4, oct. 1983.Google Scholar
  21. [Stoy 77]
    J.E. Stoy: Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory, MIT Press, 1977.Google Scholar
  22. [Wand 82]
    M. Wand: Deriving Target Code as a Representation of Continuation Semantics, ACM Transactions on Programming Languages and Systems, Vol. 4, No. 3, july 1982.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1986

Authors and Affiliations

  • Mads Dam
    • 1
  • Frank Jensen
    • 2
  1. 1.Dept. of Computer ScienceUniversity of EdinburghEdinburghUK
  2. 2.Institute of Electronic SystemsAalborg University CentreAalborgDenmark

Personalised recommendations