Abstract
This paper presents a step forward in the use of partial evaluation for interpreting and compiling programs, as well as for automatically generating a compiler from denotationrd definitions of programming languages. We determine the static and dynamic semantics of a programming language, reduce the expressions representing the static semantics, and generate object code by instantiating the expressions representing the dynamic semantics. By processing the static semantics of the language, programs get compiled. By processing the static semantics of the partial evaluator, compilers are generated. The correctness of a compiler is guaranteed by the correctness of both the executable specification and our partial evaluator. The results reported in this paper improve on previous work in the domain of compiler generation [16, 30], and solves several open problems in the domain of partial evaluation [15]. In essence: l Our compilation goes beyond a mere syntax-Tosemantics mapping since the static semantics gets processed at compile time by partial evaluation. It is really a syntax-To-dynamic-semantics mapping. Q Because our partial evaluator is self-Applicable, a compiler is actually generated. l Our partial evaluator handles non-flat binding time domains. Our source programs are enriched with an open-ended set of algebraic operators. This experiment parallels the one reported by Montenyohl and Wand in [24]: starting with the same denot ational semantics of an Algol subset, we obtain the same good results, bnt completely automatically and using the original semantics only, instead of writing several others, which requires proving their congruence. We are able to compile strongly typed, Algol-like programs and to process their static semantics at compile time (scope resolution, storage calculation, and type checking), as well ax to generate the corresponding compiler completely automatically. The object code is reasonably efficient. It has been found to be more than a hundred times faster than the interpreted source program, whereas it runs about two times slower than the out put of a regular, production-quality compiler. The compiIer is well-structured and efficient. The static semantics stiU gets processed at compile time. Self-Application pays off: compiling using the compiler is correspondingly much faster than compiling by partially evaluating the interpreter with respect to the source program. Our compiler is still slower than a production-quality one, but we derived it automatically.
Author supplied keywords
Cite
CITATION STYLE
Consel, C., & Danvy, O. (1991). Static and dynamic semantics processing. In Conference Record of the Annual ACM Symposium on Principles of Programming Languages (pp. 14–24). Association for Computing Machinery. https://doi.org/10.1145/99583.99588
Register to see more suggestions
Mendeley helps you to discover research relevant for your work.