Compile-time Reflective ML

CRML is an implementation of compile-time reflection for a subset of ML built on top of the Standard ML of New Jersey compiler. Reflection is the "magic" that turns data into programs. Compile-time reflection allows user written functions to access data calculated during compilation to construct program representations. These representations are then transformed, by reflection, into the programs they represent. Essentially, compile-time reflection allows representations (data) calculated by compile-time evaluation to be type-checked and submitted to the compiler itself, to be turned into object code and integrated with the rest of the compiler's output.

Related languages
SML/NJ => CRML   Based on
TRPL => CRML   Evolution of
CRML => MetaML   Evolution of

  • Fegaras, L. ; D. Maier, and T. Sheard. Specifying rule-based query optimizers in a reflective framework. In Third International Conference on Deductive and Object-Oriented Databases, pages 146-168, Phoenix, Arizona, December 1993 view details Abstract: Numerous structures for database query optimizers have been proposed. Many of those proposals aimed at automating the construction of query optimizers from some kind of specification of optimizer behavior. These specification frameworks do a good job of partitioning and modularizing the kinds of information needed to generate a query optimizer. Most of them represent at least part of this information in a rule-like form. Nevertheless, large portions of these specifications still take a procedural form. The contributions of this work are threefold. We present a language for specifying optimizers that captures a larger portion of the necessary information in a declarative manner. This language is in turn based on a model of query rewriting where query expressions carry annotations that are propagated during query transformation and planning. This framework is reminiscent of inherited and synthesized attributes for attribute grammars, and we believe it is expressive of a wide range of information: logical and physical properties, both desired and delivered, cost estimates, optimization contexts, and control strategies. Finally, we present a mechanism for processing optimizer specifications that is based on compile-time reflection. This mechanism proves to be succinct and flexible, allowing modifications of the specification syntax, incorporation of new capabilities into generated optimizers, and retargeting the translation to a variety of optimization frameworks. We report on an implementation of our ideas using the CRML reflective functional language and on optimizer specifications we have written for several query algebras
  • Hook, J. and Sheard, T. "A semantics of compile-time reflection" Technical Report 93-019, Dept. of Computer Science and Engineering, Oregon Graduate Institute, Portland, Oregon, 1993 view details
  • Sheard, Tim "Guide to using crml, cmopile-time reflective ml", October 1993. view details
  • Sheard, Tim "Type parametric programming" Technical Report CSE 93-018, Oregon Graduate Institute, 1993 view details