Abstract
In meta programming with concrete object syntax, object-level programs are composed from fragments written in concrete syntax. The use of small program fragments in such quotations and the use of meta-level expressions within these fragments (anti-quotation) often leads to ambiguities. This problem is usually solved through explicit disambiguation, resulting in considerable syntactic overhead. A few systems manage to reduce this overhead by using type information during parsing. Since this is hard to achieve with traditional parsing technology, these systems provide specific combinations of meta and object languages, and their implementations are difficult to reuse. In this paper, we generalize these approaches and present a language independent method for introducing concrete object syntax without explicit disambiguation. The method uses scannerless generalized-LR parsing to parse meta programs with embedded object-level fragments, which produces a forest of all possible parses. This forest is reduced to a tree by a disambiguating type checker for the meta language. To validate our method we have developed embeddings of several object languages in Java, including AspectJ and Java itself.
Access provided by Autonomous University of Puebla. Download to read the full chapter text
Chapter PDF
Similar content being viewed by others
Keywords
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.
References
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)
Bachrach, J., Playford, K.: The Java syntactic extender (JSE). In: Proceedings of the 16th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2001), pp. 31–42. ACM Press, New York (2001)
Baker, J., Hsieh, W.C.: Maya: multiple-dispatch syntax extension in java. In: PLDI 2002: Proceedings of the ACM SIGPLAN 2002 Conference on Programming language design and implementation, pp. 270–281. ACM Press, New York (2002)
Batory, D., Lofaso, B., Smaragdakis, Y.: JTS: tools for implementing domain-specific languages. In: Proceedings Fifth International Conference on Software Reuse (ICSR 1998), pp. 143–153. IEEE Computer Society Press, Los Alamitos (1998)
Baxter, I.D., Pidgeon, C., Mehlich, M.: DMS®: Program transformations for practical scalable software evolution. In: ICSE 2004: Proceedings of the 26th International Conference on Software Engineering, pp. 625–634. IEEE Computer Society, Los Alamitos (2004)
Brabrand, C., Schwartzbach, M.I.: Growing languages with metamorphic syntax macros. In: Proceedings of the 2002 ACM SIGPLAN Workshop on Partial Evaluation and Semantics-based Program Manipulation (PEPM 2002), pp. 31–40. ACM Press, New York (2002)
van den Brand, M.G.J., Klusener, S., Moonen, L., Vinju, J.J.: Generalized Parsing and Term Rewriting - Semantics Directed Disambiguation. In: Bryant, B., Saraiva, J. (eds.) LDTA 2003. ENTCS, vol. 82. Elsevier, Amsterdam (2003)
van den Brand, M.G.J., Moreau, P.E., Vinju, J.J.: A generator of efficient strongly typed abstract syntax trees in Java. IEE Proceedings - Software (May 2005)
van den Brand, M.G.J., Ringeissen, C.: ASF+SDF parsing tools applied to ELAN. In: Third International Workshop on Rewriting Logic and Applications. ENTCS (2000)
van den Brand, M.G.J., Scheerder, J., Vinju, J.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)
Bravenboer, M., Visser, E.: Concrete syntax for objects. Domain-specific language embedding and assimilation without restrictions. In: Schmidt, D.C. (ed.) Proceedings of the 19th ACM SIGPLAN Conference on Object-Oriented Programing, Systems, Languages, and Applications (OOPSLA 2004), pp. 365–383. ACM Press, New York (2004)
Cordy, J.R., Halpern-Hamu, C.D., Promislow, E.: TXL: A rapid prototyping system for programming language dialects. Computer Languages 16(1), 97–107 (1991)
de Rauglaudre, D.: Camlp4 reference manual, INRIA (September 2003)
van Deursen, A., Heering, J., Klint, P. (eds.): Language Prototyping. AMAST Series in Computing, vol. 5. World Scientific, Singapore (1996)
Eclipse Java Development Tools (JDT), website: http://www.eclipse.org/jdt/
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, Tech. Rep. 126, Università di Milano, pp. 1–20 (1994)
Leavenworth, B.M.: Syntax macros and extended translation. Commun. ACM 9(11), 790–793 (1966)
Vinju, J.J.: A type driven approach to concrete meta programming. Technical Report SEN-E0507, Centrum voor Wiskunde en Informatica (2005)
Visser, E.: Syntax Definition for Language Prototyping. PhD thesis, University of Amsterdam (September 1997)
Visser, E.: Meta-programming with concrete object syntax. In: Batory, D., Consel, C., Taha, W. (eds.) GPCE 2002. LNCS, vol. 2487, pp. 299–315. Springer, Heidelberg (2002)
Visser, E.: Program transformation with Stratego/XT: Rules, strategies, tools, and systems in StrategoXT-0.9. In: Lengauer, C., Batory, D., Consel, C., Odersky, M. (eds.) Domain-Specific Program Generation. LNCS, vol. 3016, pp. 216–238. Springer, Heidelberg (2004)
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)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2005 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Bravenboer, M., Vermaas, R., Vinju, J., Visser, E. (2005). Generalized Type-Based Disambiguation of Meta Programs with Concrete Object Syntax. In: Glück, R., Lowry, M. (eds) Generative Programming and Component Engineering. GPCE 2005. Lecture Notes in Computer Science, vol 3676. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11561347_12
Download citation
DOI: https://doi.org/10.1007/11561347_12
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-29138-1
Online ISBN: 978-3-540-31977-1
eBook Packages: Computer ScienceComputer Science (R0)