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.
Preview
Unable to display preview. Download preview PDF.
References
A. V. Aho and M. J. Corasick. Efficient string matching: an aid to bibliographic search. Communications of the ACM, 18(6):333–340, 1975.
G. Huet and J.-J. Lévy. Call by Need Computations in Non-ambiguous Linear Term Rewriting Systems. Technical Report 359, IRIA, 1979.
C. Hoffmann and M. J. O'Donnell. Pattern matching in trees. Journal of the ACM, 68–95, 1982.
C. Hoffmann and M. J. O'Donnell. Programming with equations. ACM, Transactions on Programming Languages and Systems, 83–112, 1982.
C. Hoffmann, M. J. O'Donnell, and R. Strandh. Programming with equations. Software, Practice and Experience, 1985.
K. Jensen and N. Wirth. Pascal, User Manual and Report. Springer-Verlag, Heidelberg, 1976.
J. W. Klop. Combinatory Reduction Systems. PhD thesis, Mathematisch Centrum, Amsterdam, 1980.
D. E. Knuth, J. Morris, and V. Pratt. Fast pattern matching in strings. SIAM Journal on Computing, 6(2):323–350, 1977.
B. W. Kernighan and D.M. Ritchie. The C Programming Language. Prentice-Hall, Englewood Cliffs, New Jersey, 1978.
J. McCarthy. Recursive functions of symbolic expressions and their computation by machine. Communications of the ACM, 3(4):185–195, 1960.
M. J. O'Donnell. Equational Logic as a Programming Language. MIT Press, Cambridge, Mass, 1985.
R. I. Strandh. Optimizing equational programs. In Proceedings of the Second International Conference on Rewriting Techniques and Applications, pages 13–24, Bordeaux, France, 1987.
R. I. Strandh. Compiling Equational Programs into Efficient Machine Code. PhD thesis, The Johns Hopkins University, Department of Computer Science, Baltimore, Maryland, 1988.
Author information
Authors and Affiliations
Editor information
Rights 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