Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
article
Free access

Semantic evaluation from left to right

Published: 01 February 1976 Publication History

Abstract

This paper describes attribute grammars and their use for the definition of programming languages and compilers; a formal definition of attribute grammars and a discussion of some of its important aspects are included. The paper concentrates on the evaluation of semantic attributes in a few passes from left to right over the derivation tree of a program. A condition for an attribute grammar is given which assures that the semantics of any program can be evaluated in a single pass over the derivation tree, and an algorithm is discussed which decides how many passes from left to right are in general necessary, given the attribute grammar. These notions are explained in terms of an example grammar which describes the scope rules of Algol 60. Practical questions, such as the relative efficiency of different evaluation schemes, and the ease of adapting the attribute grammar of a given programming language to the left-to-right evaluation scheme are discussed.

References

[1]
Knuth, D.E. Semantics of context-free languages. Math Systems Th. 2 (1968), 127-145. Correction appears in Math. Systems Th. 5 (1971),95.
[2]
Knuth, D.E. Examples of formal semantics, In Lecture Notes in Mathemetics No. 188, Springer-Verlag, Berlin 1971.
[3]
Bochmann, G.V. Semantic equivalence of syntactically related attribute grammars. Publ. No. 148, D6partement d'Informatique, U. de Montreal, Nov. 1973.
[4]
Wilner, W.T. Declarative semantic definition. Rep. STAN-CS- 233-71, Computer Science Dep., Stanford U., 1971. Also Wilner, W.T. Formal semantic definition using synthesized and inherited attributes. In Formal Semantics of Programming Languages, R. Rustin (Ed.), Prentice-Hall, Englewood Cliffs, N.J., 1972.
[5]
Stearns, R.E., and Lewis, P.M. Property grammars and table machines, beform, and Cootrol 14 (1969), 524-549.
[6]
Culik, K. II, Attributed grammars and languages. Publication No. 3, D6partement d'Informatique, U. de Montreal, May 1969.
[7]
Koster, C.H.A. Affix grammars. In Algol 68 Implementation, North-Holland Pub. Co., Amsterdam, 1971. See also: Crowe, D. Generating parsers for affix grammars. Comm. ACM 15 (1972), 728-732.
[8]
Morris, J.H. Jr. Types are not sets. In Proceedings of the ACM Syrup. on Principles of Programming Languages, Boston, 1973, pp. 120-124.
[9]
Fang, I. FOLDS, a declarative formal language definition system. Rep. STAN-CS-72-329, Computer Science Dep., Stanford U., 1972.
[10]
Lecarme, O., and Bochmann, G.V. A (truly) usable and portable compiler writing system. In Proc. IFIP Congress 74, North- Holland Pub. Co., Amsterdam, 1974, pp. 218-221.
[11]
Bouckaert, M., Pirotte, A., and Snelling, M. SOFT: a tool for writing software. Report R212, Laboratoire de Recherche, M.B.L.E., Brussels, Jan. 1973.
[12]
Bosch, R., Grune, D., and Meertens, L. ALEPH, a language encouraging program hierarchy. In Proc. International Computing Symp. 1973, North-Holland Pub. Co., Amsterdam, 1974, p. 73.
[13]
Lewis, P.M., Rosenkrantz, D.J., and Stearns, R.E. Attributed translations. To be published in J. Computer and Systems Sci.
[14]
Van Wijngaarden, A., et al. Revised report on the algorithmic language Algol 68. IFIP, 1973.
[15]
Naur, P. The design of the GIER ALGOL compiler. BIT, 3 (1963), 124-140 and 145-166, and Amnlal Review 4 (1965), 49-85.
[16]
Gries, D. Compiler Construction for Digital Computers. Wiley, New York, 1971.
[17]
Wirth, N. The design of a PASCAL compiler. Software- Practice and Experience 1 (1971), 309-333.
[18]
Jazayeri, M., Ogden, W.F., and Rounds, W.C. On the Complexity of the circularity test for attribute grammars. In Conf. Record, ACM Syrup. on Principles of Programming Languages, Palo Alto, Calif., Jan. 20-22, 1975, pp. 119-129.
[19]
Neel, D., and Amirchahy, M. Semantic attributes and improvement of generated code. In Proc. ACM Congress 1974, San Diego, Calif., Nov. 1974, pp. 1-10.

Cited By

View all
  • (2018)A Holistic Approach for Collaborative Workload Execution in Volunteer CloudsACM Transactions on Modeling and Computer Simulation10.1145/315533628:2(1-27)Online publication date: 9-Mar-2018
  • (2018)A Product-Form Model for the Performance Evaluation of a Bandwidth Allocation Strategy in WSNsACM Transactions on Modeling and Computer Simulation10.1145/315533528:2(1-23)Online publication date: 22-Feb-2018
  • (2017)Hybrid Grammars for Parsing of Discontinuous Phrase Structures and Non-Projective Dependency StructuresComputational Linguistics10.1162/COLI_a_0029143:3(465-520)Online publication date: Sep-2017
  • Show More Cited By

Index Terms

  1. Semantic evaluation from left to right
      Index terms have been assigned to the content through auto-classification.

      Recommendations

      Comments

      Information & Contributors

      Information

      Published In

      cover image Communications of the ACM
      Communications of the ACM  Volume 19, Issue 2
      Feb. 1976
      53 pages
      ISSN:0001-0782
      EISSN:1557-7317
      DOI:10.1145/359997
      Issue’s Table of Contents
      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      Published: 01 February 1976
      Published in CACM Volume 19, Issue 2

      Permissions

      Request permissions for this article.

      Check for updates

      Author Tags

      1. attribute grammars
      2. left-to-right parsing
      3. multipass compilers
      4. semantic attributes
      5. semantic conditions
      6. semantic evaluation
      7. semantics of programming languages

      Qualifiers

      • Article

      Contributors

      Other Metrics

      Bibliometrics & Citations

      Bibliometrics

      Article Metrics

      • Downloads (Last 12 months)113
      • Downloads (Last 6 weeks)7
      Reflects downloads up to 02 Sep 2024

      Other Metrics

      Citations

      Cited By

      View all
      • (2018)A Holistic Approach for Collaborative Workload Execution in Volunteer CloudsACM Transactions on Modeling and Computer Simulation10.1145/315533628:2(1-27)Online publication date: 9-Mar-2018
      • (2018)A Product-Form Model for the Performance Evaluation of a Bandwidth Allocation Strategy in WSNsACM Transactions on Modeling and Computer Simulation10.1145/315533528:2(1-23)Online publication date: 22-Feb-2018
      • (2017)Hybrid Grammars for Parsing of Discontinuous Phrase Structures and Non-Projective Dependency StructuresComputational Linguistics10.1162/COLI_a_0029143:3(465-520)Online publication date: Sep-2017
      • (2017)Streaming Tree TransducersJournal of the ACM10.1145/309284264:5(1-55)Online publication date: 29-Aug-2017
      • (2016)Robust Decentralized Low-Rank Matrix DecompositionACM Transactions on Intelligent Systems and Technology10.1145/28541577:4(1-24)Online publication date: 2-May-2016
      • (2015)Patent MiningACM SIGKDD Explorations Newsletter10.1145/2783702.278370416:2(1-19)Online publication date: 21-May-2015
      • (2015)CacheAuditACM Transactions on Information and System Security10.1145/275655018:1(1-32)Online publication date: 9-Jun-2015
      • (2015)Linearly Ordered Attribute GrammarsProceedings of the 2015 Workshop on Partial Evaluation and Program Manipulation10.1145/2678015.2682543(49-60)Online publication date: 13-Jan-2015
      • (2015)Transforming XML Streams with ReferencesProceedings of the 22nd International Symposium on String Processing and Information Retrieval - Volume 930910.1007/978-3-319-23826-5_4(33-45)Online publication date: 1-Sep-2015
      • (2014)From object algebras to attribute grammarsACM SIGPLAN Notices10.1145/2714064.266023749:10(377-395)Online publication date: 15-Oct-2014
      • Show More Cited By

      View Options

      View options

      PDF

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      Get Access

      Login options

      Full Access

      Media

      Figures

      Other

      Tables

      Share

      Share

      Share this Publication link

      Share on social media