Classes of equational programs that compile into efficient machine code

  • Robert I. Strandh
Regular Papers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 355)


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.


Normal Form Reduction Algorithm Query Point Index Point Index 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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [AC75]
    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. [HL79]
    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. [HO82a]
    C. Hoffmann and M. J. O'Donnell. Pattern matching in trees. Journal of the ACM, 68–95, 1982.Google Scholar
  4. [HO82b]
    C. Hoffmann and M. J. O'Donnell. Programming with equations. ACM, Transactions on Programming Languages and Systems, 83–112, 1982.Google Scholar
  5. [HOS85]
    C. Hoffmann, M. J. O'Donnell, and R. Strandh. Programming with equations. Software, Practice and Experience, 1985.Google Scholar
  6. [JW76]
    K. Jensen and N. Wirth. Pascal, User Manual and Report. Springer-Verlag, Heidelberg, 1976.Google Scholar
  7. [Klo80]
    J. W. Klop. Combinatory Reduction Systems. PhD thesis, Mathematisch Centrum, Amsterdam, 1980.Google Scholar
  8. [KMP77]
    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. [KR78]
    B. W. Kernighan and D.M. Ritchie. The C Programming Language. Prentice-Hall, Englewood Cliffs, New Jersey, 1978.Google Scholar
  10. [McC60]
    J. McCarthy. Recursive functions of symbolic expressions and their computation by machine. Communications of the ACM, 3(4):185–195, 1960.Google Scholar
  11. [ODo85]
    M. J. O'Donnell. Equational Logic as a Programming Language. MIT Press, Cambridge, Mass, 1985.Google Scholar
  12. [Str87]
    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. [Str88]
    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

Copyright information

© Springer-Verlag Berlin Heidelberg 1989

Authors and Affiliations

  • Robert I. Strandh
    • 1
  1. 1.Laboratoire Bordelais de Recherche En InformatiqueBordeauxFrance

Personalised recommendations