Summary
We investigate the problem of translating expressions optimally, i.e. such that at running time they need as few memory cells as possible and that they can be evaluated fast. An efficient (recursive) algorithm is presented (there is always one based on “trial and error”-methods) for the case of independent inputs and operators to an expression. This includes the case that the result of an operation needs not only one but an arbitrary nonnegative number of auxiliary memory cells which may be determined at compile-time.
In [5, 7, 8 and 1] it is shown that it is always possible to compose an optimal translation of an expression α1 o α2 by arbitrary but optimal translations of α1 and α2 if this number is constant. We prove now the existence of special optimal translations of α1 and α2 which always can be composed to an optimal translation of α1 o α2 in the general case. This is the hinge for a recursive algorithm.
Similar content being viewed by others
Literatur
Bruno, J. L., Lassagne, T.: The generation of optimal code for stack machines. J. ACM 22, 296–382 (1975)
Harary, F., Norman, R. Z., Cartwright, D.: Structural models: An introduction to the theory of directed graphs. New York-London-Sydney: John Wiley & Sons 1965
Kameda, T., Abdel-Wahab, H.M.: An n log n algorithm for storage-optimal sequencing under multi-linear precedence constraint (Extendet abstract). University of Waterloo, Waterloo, Ontario, Canada (unpublished) (1973)
Kandzia, P., Langmaack, H.: Informatik: Programmierung. Stuttgart: Teubner 1973
Nakata, I.: On compiling algorithms for arithmetic expressions. Comm. ACM 10, 492–494 (1967)
Peters, U.: Der Hilfszellenbedarf von übersetzten Ausdrücken. Dissertation, Saarbrücken 1973
Redziejowski, R. R.: On arithmetic expressions and trees. Comm. ACM 12, 81–84 (1969)
Sethi, R., Ullman, J. D.: The generation of optimal code for arithmetic expressions. J. ACM 17, 715–728 (1970)
Author information
Authors and Affiliations
Additional information
Abschließend sei es mir erlaubt, Herrn Prof. Dr. H. Walter für die Anregung zu dieser Arbeit und Frau Dr. B. Schinzel für die hilfreichen Gespräche in diesem Zusammenhang herzlich zu danken.
Rights and permissions
About this article
Cite this article
Kern, W. Speicheroptimale Formelübersetzung. Acta Informatica 7, 269–287 (1977). https://doi.org/10.1007/BF00290337
Received:
Issue Date:
DOI: https://doi.org/10.1007/BF00290337