Type-Driven Automatic Quotation of Concrete Object Code in Meta Programs

  • J. J. Vinju
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3943)


Meta programming can be facilitated by the ability to represent program fragments in concrete syntax instead of abstract syntax. The resulting meta programs are more self-documenting. One caveat in concrete meta programming is the syntactic separation between the meta language and the object language. To solve this problem, many meta programming systems use quoting and anti-quoting to indicate precisely where level switches occur. These “syntactic hedges” can obfuscate the concrete program fragments. This paper describes an algorithm for inferring quotes, such that the meta programmer no longer needs to explicitly indicate transitions between the meta and object languages.


Object Language Abstract Syntax Parse Tree Concrete Syntax Abstract Syntax Tree 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    McCarthy, J., Abrahams, P.W., Edwards, D.J., Hart, T.P., Levin, M.I.: LISP 1.5 Programmer’s Manual. The MIT Press, Cambridge (1966)Google Scholar
  2. 2.
    Sellink, M., Verhoef, C.: Native patterns. In: Blaha, M., Quilici, A., Verhoef, C. (eds.) Proceedings of the Fifth Working Conference on Reverse Engineering, pp. 89–103. IEEE Computer Society Press, Los Alamitos (1998)Google Scholar
  3. 3.
    Heering, J., Hendriks, P., Klint, P., Rekers, J.: The syntax definition formalism SDF - reference manual. SIGPLAN Notices 24, 43–75 (1989)CrossRefGoogle Scholar
  4. 4.
    Brand, M.v.d., Scheerder, J., Vinju, J., Visser, E.: Disambiguation Filters for Scannerless Generalized LR Parsers. In: Horspool, R.N. (ed.) CC 2002. LNCS, vol. 2304, pp. 143–158. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  5. 5.
    Bravenboer, M., Vermaas, R., Vinju, J., Visser, E.: Generalized type-based disambiguation of meta programs with concrete object syntax. In: Generative Programming and Component Engineering (GPCE) (to appear, 2005)Google Scholar
  6. 6.
    Leavenworth, B.M.: Syntax macros and extended translation. Commun. ACM 9, 790–793 (1966)CrossRefMATHGoogle Scholar
  7. 7.
    Aasa, A., Petersson, K., Synek, D.: Concrete syntax for data objects in functional languages. In: Proceedings of the 1988 ACM conference on LISP and functional programming, pp. 96–105. ACM Press, New York (1988)CrossRefGoogle Scholar
  8. 8.
    Zook, D., Huang, S.S., Smaragdakis, Y.: Generating AspectJ programs with Meta-AspectJ. In: Karsai, G., Visser, E. (eds.) GPCE 2004. LNCS, vol. 3286, pp. 1–19. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  9. 9.
    Brand, M., Deursen, A., Heering, J., Jong, H., Jonge, M., Kuipers, T., Klint, P., Moonen, L., Olivier, P.A., Scheerder, J., Vinju, J., Visser, E., Visser, J.: The ASF+SDF Meta-Environment: a Component-Based Language Development Environment. In: Wilhelm, R. (ed.) CC 2001. LNCS, vol. 2027, pp. 365–370. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  10. 10.
    Visser, E.: Stratego: A language for program transformation based on rewriting strategies. System description of Stratego 0.5. In: Middeldorp, A. (ed.) RTA 2001. LNCS, vol. 2051, pp. 357–361. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  11. 11.
    Visser, E.: Meta-programming with concrete object syntax. In: Batory, D., Consel, C., Taha, W. (eds.) GPCE 2002. LNCS, vol. 2487, p. 299. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  12. 12.
    Cordy, J., Halpern-Hamu, C., Promislow, E.: TXL: A rapid prototyping system for programming language dialects. Computer Languages 16, 97–107 (1991)CrossRefGoogle Scholar
  13. 13.
    Klint, P., Visser, E.: Using filters for the disambiguation of context-free grammars. In: Pighizzini, G., San Pietro, P. (eds.) Proc. ASMICS Workshop on Parsing Theory, Milano, Italy, Tech. Rep. 126–1994, Dipartimento di Scienze dell’Informazione, Università di Milano, pp. 1–20 (1994)Google Scholar
  14. 14.
    Brand, M., Klusener, S., Moonen, L., Vinju, J.: Generalized Parsing and Term Rewriting - Semantics Directed Disambiguation. In: Bryant, B., Saraiva, J. (eds.) Third Workshop on Language Descriptions Tools and Applications. Electronic Notes in Theoretical Computer Science, vol. 82. Elsevier, Amsterdam (2003)Google Scholar
  15. 15.
    Aho, A., Sethi, R., Ullman, J.: Compilers. Principles, Techniques and Tools. Addison-Wesley, Reading (1986)MATHGoogle Scholar
  16. 16.
    Paakki, J.: Attribute grammar paradigms: a high-level methodology in language implementation. ACM Comput. Surv. 27, 196–255 (1995)CrossRefGoogle Scholar
  17. 17.
    Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17, 348–375 (1978)MathSciNetCrossRefMATHGoogle Scholar
  18. 18.
    Johnson, M.: The computational complexity of GLR parsing. In: Tomita, M. (ed.) Generalized LR Parsing, pp. 35–42. Kluwer, Boston (1991)CrossRefGoogle Scholar
  19. 19.
    Billot, S., Lang, B.: The structure of shared forests in ambiguous parsing. In: Proceedings of the 27th annual meeting on Association for Computational Linguistics, Morristown, NJ, USA, pp. 143–151 (1989)Google Scholar
  20. 20.
    Brand, M., Jong, H., Klint, P., Olivier, P.: Efficient Annotated Terms. Software, Practice & Experience 30, 259–291 (2000)CrossRefGoogle Scholar
  21. 21.
    Vinju, J.: A type driven approach to concrete meta programming. Technical Report SEN-E0507, CWI (2005)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • J. J. Vinju
    • 1
  1. 1.Centrum voor Wiskunde en InformaticaAmsterdamThe Netherlands

Personalised recommendations