Growing languages with metamorphic syntax macros

  • Authors:
  • Claus Brabrand;Michael I. Schwartzbach

  • Affiliations:
  • University of Aarhus, Ny Munkegade, building 540 8000 Aarhus C, Denmark;University of Aarhus, Ny Munkegade, building 540 8000 Aarhus C, Denmark

  • Venue:
  • PEPM '02 Proceedings of the 2002 ACM SIGPLAN workshop on Partial evaluation and semantics-based program manipulation
  • Year:
  • 2002

Quantified Score

Hi-index 0.00

Visualization

Abstract

"From now on, a main goal in designing a language should be to plan for growth." Guy Steele: Growing a Language, OOPSLA '98 invited talk.We present our experiences with a syntax macro language which we claim forms a general abstraction mechanism for growing (domain-specific) extensions of programming languages. Our syntax macro language is designed to guarantee type safety and termination.A concept of metamorphisms allows the arguments of a macro to be inductively defined in a meta level grammar and morphed into the host language. We also show how the metamorphisms can be made to operate simultaneously on multiple parse trees at once. The result is a highly flexible mechanism for growing new language constructs without resorting to compile-time programming. In fact, whole new languages can be defined at surprisingly low cost.This work is fully implemented as part of the bigwig system for defining interactive Web services, but could find use in many other languages.