Skip to main content

Classes of equational programs that compile into efficient machine code

  • Regular Papers
  • Conference paper
  • First Online:
Rewriting Techniques and Applications (RTA 1989)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 355))

Included in the following conference series:

Abstract

Huet and Lévy [HL79] showed that, if an equational program E is strongly sequential, there exists an automaton that, given a term in the language L(E), finds a redex in that term.

The most serious problem with their approach becomes evident when one tries to use their result in a programming system. Once a redex has been found, it must be replaced by a term built from the structure of the right-hand side corresponding to the redex, and from parts of the old term. Then, the reduction process must be restarted so that other redexes can be found. With their approach, a large part of the term tree may have to be rescanned.

Hoffmann and O'Donnell [HO82a] improved the situation by defining the class of strongly left-sequential programs. For this class, a particularly simple reduction algorithm exists. A stack is used to hold information about the state of the reduction process. When a redex has been found and replaced by the corresponding right-hand side, the stack holds all the relevant information needed to restart the reduction process in a well defined state such that no unnecessary rescanning of the term is done.

However, it turns out that the approach of Hoffmann and O'Donnell is unnecessarily restrictive. In this paper, we define a new class of Equational Programs, called the forward branching programs. This class is much larger than the class of strongly left-sequential programs. Together with a new reduction algorithm, briefly discussed in this paper, our approach allows us to use the hardware stack to hold reduction information in a way similar to the way a block structured programming language uses the stack to hold local variables. In effect, our approach allows us to use innermost stabilization, while preserving the overall outermost reduction strategy.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. A. V. Aho and M. J. Corasick. Efficient string matching: an aid to bibliographic search. Communications of the ACM, 18(6):333–340, 1975.

    Google Scholar 

  2. G. Huet and J.-J. Lévy. Call by Need Computations in Non-ambiguous Linear Term Rewriting Systems. Technical Report 359, IRIA, 1979.

    Google Scholar 

  3. C. Hoffmann and M. J. O'Donnell. Pattern matching in trees. Journal of the ACM, 68–95, 1982.

    Google Scholar 

  4. C. Hoffmann and M. J. O'Donnell. Programming with equations. ACM, Transactions on Programming Languages and Systems, 83–112, 1982.

    Google Scholar 

  5. C. Hoffmann, M. J. O'Donnell, and R. Strandh. Programming with equations. Software, Practice and Experience, 1985.

    Google Scholar 

  6. K. Jensen and N. Wirth. Pascal, User Manual and Report. Springer-Verlag, Heidelberg, 1976.

    Google Scholar 

  7. J. W. Klop. Combinatory Reduction Systems. PhD thesis, Mathematisch Centrum, Amsterdam, 1980.

    Google Scholar 

  8. D. E. Knuth, J. Morris, and V. Pratt. Fast pattern matching in strings. SIAM Journal on Computing, 6(2):323–350, 1977.

    Google Scholar 

  9. B. W. Kernighan and D.M. Ritchie. The C Programming Language. Prentice-Hall, Englewood Cliffs, New Jersey, 1978.

    Google Scholar 

  10. J. McCarthy. Recursive functions of symbolic expressions and their computation by machine. Communications of the ACM, 3(4):185–195, 1960.

    Google Scholar 

  11. M. J. O'Donnell. Equational Logic as a Programming Language. MIT Press, Cambridge, Mass, 1985.

    Google Scholar 

  12. R. I. Strandh. Optimizing equational programs. In Proceedings of the Second International Conference on Rewriting Techniques and Applications, pages 13–24, Bordeaux, France, 1987.

    Google Scholar 

  13. R. I. Strandh. Compiling Equational Programs into Efficient Machine Code. PhD thesis, The Johns Hopkins University, Department of Computer Science, Baltimore, Maryland, 1988.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Nachum Dershowitz

Rights and permissions

Reprints and permissions

Copyright information

© 1989 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Strandh, R.I. (1989). Classes of equational programs that compile into efficient machine code. In: Dershowitz, N. (eds) Rewriting Techniques and Applications. RTA 1989. Lecture Notes in Computer Science, vol 355. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-51081-8_125

Download citation

  • DOI: https://doi.org/10.1007/3-540-51081-8_125

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-51081-9

  • Online ISBN: 978-3-540-46149-4

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics