Nothing Special   »   [go: up one dir, main page]

skip to main content
article
Free access

Parse tree annotations

Published: 01 December 1989 Publication History

Abstract

A technique for associating rewrite rules with productions so that many high-level transformations of a source file can be generated easily is described. While eclipsed in power by other editing and compiler generation systems supporting management of both synthesized and inherited attributes, this approach is especially simple to employ and is sufficient in power to deal with a wide class of problems arising from practical applications.

References

[1]
Aho, A., and Ullman, J. The Theory of Parsing, Translation, and Compilating. Vol II, Prentice Hall, Englewood Cliffs, N.J., 1973.
[2]
Basili, V., and Rombach, H. D. The TAME project: Towards improvement-oriented software environments. IEEE Trans. Softw. Eng. 14, 6 (June 1988), 759-773.
[3]
Brewer, O., Dongarra, )., and Sorensen, D. Tools to aid in the analysis of memory access pattern for FORTRAN programs. Parallel Computing 9, (1988), 25-35.
[4]
Farrow, R. Generating a procduction compiler from an attribute grammar. IEEE Softw. 1, 4 (Oct. 1984), 77-93.
[5]
Johnson, G., and Fischer, C. A meta-language and system for nonlocal incremental attribute grammar evaluation in language-based editors. In Proceedings of the 12th Annual ACM Symposium on Principles of Programming Languages (New Orleans, La., Jan 14-16). ACM, New York, 1985, pp. 141-151.
[6]
Johnson, S. Yacc: Yet another compiler-compiler. Bell Laboratories, 1979.
[7]
Purtilo, J. On specifying an environment. In Proceedings of the IEEE's 9th International Computer Software and Applications Conference {Newport Beach, Calif., June 5-9). IEEE, New York, 1989, pp. 456-463.
[8]
Purtilo, J. A software interconnection technology. Tech. Rep. TR- 2139. Dept. of Computer Science, Univ. of Maryland, 1988.
[9]
Purtilo, J. Polylith: An environment to support management of tool interfaces. In Proceedings of ACM SIGPLAN Symposium on Language Issues in Programming Environments (Seattle, Wash., June 25-28). ACM/SIGPLAN, New York, 1985, pp. 12-18.
[10]
Reps, T., and Teitelbaum, T. The synthesizer generator. In Proceedings of the ACM SIGSOFT-SIGPLAN Software Engineering Symposium on Practical Software Development Environments (Pittsburgh, Pa., April 23-25). ACM, New York, 1984, pp. 42-48.

Cited By

View all
  • (2015)AMOEBA: Designing for collaboration in computer science classrooms through live learning analyticsInternational Journal of Computer-Supported Collaborative Learning10.1007/s11412-015-9217-z10:4(425-447)Online publication date: 1-Aug-2015
  • (2009)ReAssertProceedings of the 24th IEEE/ACM International Conference on Automated Software Engineering10.1109/ASE.2009.17(433-444)Online publication date: 16-Nov-2009
  • (2006)Linking Analysis and Transformation Tools with Source-Based MappingsProceedings of the Sixth IEEE International Workshop on Source Code Analysis and Manipulation10.1109/SCAM.2006.18(107-116)Online publication date: 27-Sep-2006
  • Show More Cited By

Recommendations

Reviews

David Thomas Barnard

The authors present a technique for associating translation rules with the productions of a grammar and give some applications of the kinds of translations that can be produced. Their technique is not as powerful as methods based on attribute grammars, but its virtue is its simplicity. The paper has two explicit goals: to illustrate the notation in a variety of applications and to show how the approach can be used in conjunction with tools in a programming environment. The system described is a modification of yacc —it allows the parse tree to be retained and rules for transducing the source program to be associated with the parse tree. The rules are actually associated with each production of the grammar, and several different rules, distinguished by identifiers, can be associated with a production. Although the authors do not give the details of the language used in the translation rules, examples show reordering, selecting only parts of the subtree to be examined, and conditional application of rules. It is possible to introduce variables, essentially attached to nodes of the parse tree, that can be assigned values and referenced as the subtree rooted at the node is processed. The authors show applications for reordering an expression (infix to postfix), generating execution profiles of programs, generating output for a tool that can display the execution of a program on a statement-by-statement basis, and generating other source notations for parts of a program (a module “outline”). Readers should be prepared to struggle with a presentation that could have been improved by more careful editing and proofreading. Better editing would have eliminated a few pronouns with ambiguous antecedents and a small number of missing referents. The authors should have added a sentence or two to describe details that are used in some examples without explanation (for example, the NULL translation used in Figure 3, the “$$” notation in yacc rules). The paper contains a few typographical errors: “$” appears instead of “$1” in the rule for addition on page 1469 and in Figure 4; a bad line break occurs in the literal for a single break on page 1469; a grammar example on page 1469 uses two single quotes where other examples use double quotes; Figure 2 uses two different types of mark for the same kind of string; references to Figures 12 and 13 are interchanged; and reference 4 contains a misspelling. The authors have also made some choices that obscure the presentation. The symbol “$” is used in yacc rules, but their new translation rules use “#” for the same purpose; they give no reason for this change. Figure 11 introduces a new program in a new language rather than using the example already under discussion; and Figure 13 introduces a notation that at best obscures the point being made, because the notation is not explained and the example introduces details that are not present in the program from which it is derived. The paper achieves its goals, and I recommend it to readers interested in developing suites of tools based on program transformations. The techniques could probably be applied to sources other than programs, such as documents with formal descriptions, but the authors do not address this topic.

Access critical reviews of Computing literature here

Become a reviewer for Computing Reviews.

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image Communications of the ACM
Communications of the ACM  Volume 32, Issue 12
Dec. 1989
92 pages
ISSN:0001-0782
EISSN:1557-7317
DOI:10.1145/76380
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 December 1989
Published in CACM Volume 32, Issue 12

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Attribute grammars
  2. parsers
  3. software interconnection systems
  4. source-to-source transformations

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)134
  • Downloads (Last 6 weeks)17
Reflects downloads up to 16 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2015)AMOEBA: Designing for collaboration in computer science classrooms through live learning analyticsInternational Journal of Computer-Supported Collaborative Learning10.1007/s11412-015-9217-z10:4(425-447)Online publication date: 1-Aug-2015
  • (2009)ReAssertProceedings of the 24th IEEE/ACM International Conference on Automated Software Engineering10.1109/ASE.2009.17(433-444)Online publication date: 16-Nov-2009
  • (2006)Linking Analysis and Transformation Tools with Source-Based MappingsProceedings of the Sixth IEEE International Workshop on Source Code Analysis and Manipulation10.1109/SCAM.2006.18(107-116)Online publication date: 27-Sep-2006
  • (2006)The TXL source transformation languageScience of Computer Programming10.1016/j.scico.2006.04.00261:3(190-210)Online publication date: 1-Aug-2006
  • (2005)Toward an engineering discipline for grammarwareACM Transactions on Software Engineering and Methodology10.1145/1072997.107300014:3(331-380)Online publication date: 1-Jul-2005
  • (2005)Mappings make data processing go 'roundProceedings of the 2005 international conference on Generative and Transformational Techniques in Software Engineering10.1007/11877028_6(169-218)Online publication date: 4-Jul-2005
  • (2004)TXL - A Language for Programming Language Tools and ApplicationsElectronic Notes in Theoretical Computer Science (ENTCS)10.5555/2773566.2773666110:C(3-31)Online publication date: 31-Dec-2004
  • (2004)TXL - A Language for Programming Language Tools and ApplicationsElectronic Notes in Theoretical Computer Science10.1016/j.entcs.2004.11.006110(3-31)Online publication date: Dec-2004
  • (2002)Towards environment-retargetable parser generatorsAdvances in software engineering10.5555/505630.505648(407-437)Online publication date: 1-Jan-2002
  • (2002)Source transformation in software engineering using the TXL transformation systemInformation and Software Technology10.1016/S0950-5849(02)00104-044:13(827-837)Online publication date: Oct-2002
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media