Advertisement

Metaphor: A Multi-stage, Object-Oriented Programming Language

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3286)

Abstract

This paper presents a language (called Metaphor) for expressing staged programs in a strongly-typed, imperative, object-oriented environment. The language is based on a subset of C# or Java; it is multi-stage and provides static type checking of later stage code. Object-oriented frameworks usually offer a type introspection or reflection capability to discover information about types at run-time. Metaphor allows this reflection system to be incorporated into the language’s staging constructs, thus allowing the generation of code based on the structure of types – a common application for code generation in these environments. The paper presents the language, gives a formal description of its type system and discusses a prototype implementation of the language as a compiler targeting the .NET Common Language Runtime.

Keywords

Type System Type Variable Type Type Type Rule Code Expression 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Taha, W., Sheard, T.: Multi-stage programming with explicit annotations. In: Partial Evaluation and Semantics-Based Program Manipulation, Amsterdam, The Netherlands, June 1997, pp. 203–217. ACM, New York (1997)CrossRefGoogle Scholar
  2. 2.
    Taha, W.: Multi-Stage Programming: Its Theory and Applications. PhD thesis, Oregon Graduate Institute of Science and Technology (1999)Google Scholar
  3. 3.
    Sheard, T.: Accomplishments and research challenges in meta-programming. In: Taha, W. (ed.) SAIG 2001. LNCS, vol. 2196, p. 2. Springer, Heidelberg (2001) (invited talk)CrossRefGoogle Scholar
  4. 4.
    Sheard, T., Benaissa, Z., Martel, M.: Introduction to multi-stage programming using MetaML. Technical report, Pacific Software Research Center, Oregon Graduate Institute (2000)Google Scholar
  5. 5.
    Jansson, P., Jeuring, J.: PolyP – A polytypic programming language extension. In: ACM Symposium on Principles of Programming Languages, POPL 1997, Paris, France, January 15-17, pp. 470–482. ACM Press, New York (1997)CrossRefGoogle Scholar
  6. 6.
    Hinze, R., Peyton Jones, S.: Derivable type classes. In: Hutton, G. (ed.) Haskell Workshop, Montreal, Canada (2000)Google Scholar
  7. 7.
    Cheney, J., Hinze, R.: A lightweight implementation of Generics and Dynamics. In: Haskell 2002, Pittsburgh, Pennsylvania, USA (2002)Google Scholar
  8. 8.
    Sheard, T., Benaissa, Z., Pasalic, E.: DSL implementation using staging and monads. In: Domain-Specific Languages, pp. 81–94 (1999)Google Scholar
  9. 9.
    Igarashi, A., Pierce, B., Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ. In: Meissner, L. (ed.) Proceedings of the 1999 ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages & Applications (OOPSLA 1999), N. Y, vol. 34(10), pp. 132–146 (1999)Google Scholar
  10. 10.
    Kennedy, A., Syme, D.: Transposing F to C#. In: Proceedings of Workshop on Formal Techniques for Java-like Programs, Málaga, Spain (2002)Google Scholar
  11. 11.
    Calcagno, C., Moggi, E., Taha, W.: Closed types as a simple approach to safe imperative multi-stage programming. In: Automata, Languages and Programming, pp. 25–36 (2000)Google Scholar
  12. 12.
    Taha, W., Nielsen, M.F.: Environment classifiers. In: Proceedings of the 30th ACM Symposium on Principles of Programming Languages (POPL 2003), New Orleans, Louisiana, ACM Press, New York (2003)Google Scholar
  13. 13.
    Calcagno, C., Moggi, E., Taha, W.: ML-like inference for classifiers. In: Schmidt, D. (ed.) ESOP 2004. LNCS, vol. 2986, pp. 79–93. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  14. 14.
    Sheard, T., Peyton Jones, S.: Template metaprogramming for Haskell. In: Chakravarty, M. (ed.) ACM SIGPLAN Haskell Workshop 2002, pp. 1–16. ACM Press, New York (2002)CrossRefGoogle Scholar
  15. 15.
    Calcagno, C., Taha, W., Huang, L., Leroy, X.: Implementing multi-stage languages using ASTs, Gensym, and Reflection. In: Generative Programming and Component Engineering (2003)Google Scholar
  16. 16.
    Engler, D.R., Hsieh, W.C., Kaashoek, M.F.: ´C: A language for high-level, efficient, and machine-independent dynamic code generation. In: Symposium on Principles of Programming Languages, pp. 131–144 (1996)Google Scholar
  17. 17.
    Hornof, L., Jim, T.: Certifying compilation and run-time code generation. In: Partial Evaluation and Semantic-Based Program Manipulation, pp. 60–74 (1999)Google Scholar
  18. 18.
    Jim, T., Morrisett, G., Grossman, D., Hicks, M., Cheney, J., Wang, Y.: Cyclone: A safe dialect of C. In: USENIX Annual Technical Conference, Monterey, CA, June 2002 (2002)Google Scholar
  19. 19.
    Oiwa, Y., Masuhara, H., Yonezawa, A.: DynJava: Type safe dynamic code generation in Java. In: JSST Workshop on Programming and Programming Languages, Tokyo (2001)Google Scholar
  20. 20.
    Attardi, G., Cisternino, A., Kennedy, A.: CodeBricks: Code fragments as building blocks. In: ACM Symposium on Partial Evaluation and Semantics-Based Program Manipulation (2003)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  1. 1.Centre for Information Technology InnovationQueensland University of TechnologyBrisbaneAustralia

Personalised recommendations