Advertisement

Mathematical systems theory

, Volume 2, Issue 2, pp 127–145 | Cite as

Semantics of context-free languages

  • Donald E. Knuth
Article

Abstract

“Meaning” may be assigned to a string in a context-free language by defining “attributes” of the symbols in a derivation tree for that string. The attributes can be defined by functions associated with each production in the grammar. This paper examines the implications of this process when some of the attributes are “synthesized”, i.e., defined solely in terms of attributes of thedescendants of the corresponding nonterminal symbol, while other attributes are “inherited”, i.e., defined in terms of attributes of theancestors of the nonterminal symbol. An algorithm is given which detects when such semantic rules could possibly lead to circular definition of some attributes. An example is given of a simple programming language defined with both inherited and synthesized attributes, and the method of definition is compared to other techniques for formal specification of semantics which have appeared in the literature.

Keywords

Computational Mathematic Programming Language Formal Specification Derivation Tree Simple Programming 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [1]
    J. W. de Bakker,Formal definition of programming languages, with an application to the definition of ALGOL 60, Math Cent. Tracts16, Mathematisch Centrum, Amsterdam, 1967.Google Scholar
  2. [2]
    C. Böhm, The CUCH as a formal and description language,Formal Language Description Languages for Computer Programming, pp. 266–294, Proc. IFIP Working Conf., Vienna (1964), North Holland, 1966.Google Scholar
  3. [3]
    Corrado Böhm andWolf Gross, “Introduction to thecuch,”Automata Theory (ed. by E. R. Caianiello), pp. 35–65, Academic Press, 1966.Google Scholar
  4. [4]
    C. C. Elgot, “Machine species and their computation languages,”Formal Language Description Languages for Computer Programming, pp. 160–179, Proc. IFIP Working Conf., Vienna (1964), North Holland, 1966.Google Scholar
  5. [5]
    C. C. Elgot andA. Robinson, “Random-access, stored program machines, an approach to programming languages,”J. ACM 11 (1964), 365–399.Google Scholar
  6. [6]
    Edgar T. Irons, A syntax directed compiler forAlgol 60,Comm. ACM 4 (1961), 51–55.Google Scholar
  7. [7]
    Edgar T. Irons, Towards more versatile mechanical translators, Proc. Sympos. Appl. Math., Vol. 15, pp. 41–50, Amer. Math. Soc., Providence, R. I., 1963.Google Scholar
  8. [8]
    Donald E. Knuth,The Art of Computer Programming, I, Addison-Wesley, 1968.Google Scholar
  9. [9]
    P. J. Landin, “The mechanical evaluation of expressions,”Comp. J. 6 (1964), 308–320.Google Scholar
  10. [10]
    P. J. Landin, A formal description ofAlgol 60,Formal Language Description Languages for Computer Programming, pp. 266–294, Proc. IFIP Working Conf., Vienna, (1964), North Holland, 1966.Google Scholar
  11. [11]
    P. J. Landin, A correspondence betweenAlgol 60 and Church's lambda notation,Comm. ACM 8 (1965), 89–101, 158–165.Google Scholar
  12. [12]
    John McCarthy, A formal definition of a subset ofAlgol,Formal Language Description Languages for Computer Programming, pp. 1–12, Proc. IFIP Working Conf., Vienna (1964), North Holland, 1966.Google Scholar
  13. [13]
    John McCarthy andJames Painter, Correctness of a compiler for arithmetic expressions, Proc. Sympos. Appl. Math., Vol. 17, to appear, Amer. Math. Soc., Providence, R. I., 1967.Google Scholar
  14. [14]
    Robert M. McClure, TMG—A syntax directed compiler,Proc. ACM Nat. Conf. 20 (1965), 262–274.Google Scholar
  15. [15]
    PL/I Definition Group of the Vienna Laboratory,Formal definition of PL/I, IBM Technical Report TR 25.071 (1966).Google Scholar
  16. [16]
    Niklaus Wirth andHelmut Weber, Euler: A generalization ofAlgol, and its formal definition,Comm. ACM 9 (1966), 11–23, 89–99, 878.Google Scholar

Copyright information

© Springer-Verlag New York Inc. 1968

Authors and Affiliations

  • Donald E. Knuth
    • 1
  1. 1.California Institute of TechnologyUSA

Personalised recommendations