Abstract
Traversals of heterogeneous object structures are the most common operations in schema-first applications where the three key issues are (1) separation of traversal specifications from type-specific actions, (2) expressiveness and reusability of traversal specifications, and (3) supporting structure-shy traversal specifications that require minimal adaptation in the face of schema evolution. This paper presents Language for Embedded quEry and traverSAl (LEESA), which provides a generative programming approach to address the above issues. LEESA is an object structure traversal language embedded in C++. Using C++ templates, LEESA combines the expressiveness of XPath’s axes-oriented traversal notation with the genericity and programmability of Strategic Programming. LEESA uses the object structure meta-information to statically optimize the traversals and check their compatibility against the schema. Moreover, a key usability issue of domain-specific error reporting in embedded DSL languages has been addressed in LEESA through a novel application of Concepts, which is an upcoming C++ standard (C++0x) feature. We present a quantitative evaluation of LEESA illustrating how it can significantly reduce the development efforts of schema-first applications.
Chapter PDF
References
Thompson, H.S., Beech, D., Maloney, M., Mendelsohn, N., et al.: XML Schema Part 1: Structures. W3C Recommendation (2001)
Sztipanovits, J., Karsai, G.: Model-Integrated Computing. IEEE Computer 30(4), 110–112 (1997)
Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading (1995)
Lämmel, R., Visser, E., Visser, J.: The Essence of Strategic Programming, p. 18 (October 15, 2002), http://www.cwi.nl/~ralf
Ovlinger, J., Wand, M.: A Language for Specifying Recursive Traversals of Object Structures. SIGPLAN Not. 34(10), 70–81 (1999)
Gray, J., Karsai, G.: An Examination of DSLs for Concisely Representing Model Traversals and Transformations. In: 36th Hawaiian International Conference on System Sciences (HICSS), pp. 325–334 (2003)
Mernik, M., Heering, J., Sloane, A.M.: When and How to Develop Domain-specific Languages. ACM Computing Surveys 37(4), 316–344 (2005)
Czarnecki, K., O’Donnell, J., Striegnitz, J., Taha, W.: DSL Implementation in MetaOCaml, Template Haskell, and C++. In: Domain Specific Program Generation 2004, pp. 51–72 (2004)
Seefried, S., Chakravarty, M., Keller, G.: Optimising Embedded DSLs using Template Haskell (2003)
Balland, E., Brauner, P., Kopetz, R., Moreau, P.E., Reilles, A.: Tom: Piggybacking Rewriting on Java. In: Baader, F. (ed.) RTA 2007. LNCS, vol. 4533, pp. 36–47. Springer, Heidelberg (2007)
Visser, J.: Visitor Combination and Traversal Control. In: OOPSLA 2001: Proceedings of the 16th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications, pp. 270–282 (2001)
Lämmel, R., Visser, J.: Typed Combinators for Generic Traversal. In: Krishnamurthi, S., Ramakrishnan, C.R. (eds.) PADL 2002. LNCS, vol. 2257, pp. 137–154. Springer, Heidelberg (2002)
Lieberherr, K.J.: Adaptive Object-Oriented Software: The Demeter Method with Propagation Patterns. PWS Publishing Company (1996)
Lieberherr, K., Patt-shamir, B.: Traversals of Object Structures: Specification and Efficient Implementation. ACM Trans. Program. Lang. Syst., 370–412 (1997)
Czarnecki, K., Eisenecker, U.W.: Generative Programming: Methods, Tools, and Applications. Addison-Wesley, Reading (2000)
World Wide Web Consontium (W3C): XML Path Language (XPath), Version 2.0, W3C Recommendation (January 2007), http://www.w3.org/TR/xpath20
Visser, E., Benaissa, Z., Tolmach, A.: Building Program Optimizers with Rewriting Strategies. In: Proceedings of the International Conference on Functional Programming (ICFP 1998), pp. 13–26. ACM Press, New York (1998)
Abrahams, D., Gurtovoy, A.: C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond (C++ in Depth Series). Addison-Wesley Professional, Reading (2004)
Gregor, D., Järvi, J., Siek, J., Stroustrup, B., Reis, G.D., Lumsdaine, A.: Concepts: Linguistic Support for Generic Programming in C++. In: Proceedings of the Object Oriented Programming, Systems, Languages, and Applications (OOPSLA), pp. 291–310 (2006)
Siek, J.G., Lumsdaine, A.: C++ Concept Checking. Dr. Dobb’s J. 26(6), 64–70 (2001)
Portland Pattern Repository WikiWikiWeb: Hierarchical Visitor Pattern (2005), http://c2.com/cgi/wiki?HierarchicalVisitorPattern
Simeoni, F., Lievens, D., Connor, R., Manghi, P.: Language Bindings to XML. IEEE Internet Computing, 19–27 (2003)
Magyari, E., Bakay, A., Lang, A., Paka, T., Vizhanyo, A., Agrawal, A., Karsai, G.: UDM: An Infrastructure for Implementing Domain-Specific Modeling Languages. In: The 3rd OOPSLA Workshop on Domain-Specific Modeling (October 2003)
Veldhuizen, T.: Expression Templates. C++ Report 7(5), 26–31 (1995)
Tambe, S., Gokhale, A.: An Embedded Declarative Language for Hierarchical Object Structure Traversal. In: 2nd International Workshop on Domain-Specific Program Development (DSPD) (October 2008)
Becker, P.: Standard for Programming Language C++. Working Draft, N2798=08-0308, ISO/IEC JTC 1, Information Technology, Subcommittee SC 22, Programming Language C++ (October 2008)
Gregor, D.: ConceptGCC: Concept Extensions for C++ (August 2008), http://www.generic-programming.org/software/ConceptGCC
Lédeczi, Á., Bakay, Á., Maróti, M., Völgyesi, P., Nordstrom, G., Sprinkle, J., Karsai, G.: Composing Domain-Specific Design Environments. Computer 34(11), 44–51 (2001)
Balasubramanian, K., Balasubramanian, J., Parsons, J., Gokhale, A., Schmidt, D.C.: A Platform-Independent Component Modeling Language for Distributed Real-Time and Embedded Systems. In: RTAS 2005, pp. 190–199 (2005)
Munkby, G., Priesnitz, A., Schupp, S., Zalewski, M.: Scrap++: Scrap Your Boilerplate in C++. In: WGP 2006: Proceedings of the 2006 ACM SIGPLAN workshop on Generic programming, pp. 66–75 (2006)
Lämmel, R., Visser, E., Visser, J.: Strategic programming meets adaptive programming. In: Proc. Aspect-Oriented Software Development (AOSD), pp. 168–177 (2003)
Alcino, C., Joost, V.: Transformation of Structure-Shy Programs: Applied to XPath Queries and Strategic Functions. In: PEPM 2007: Proceedings of the 2007 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation, pp. 11–20 (2007)
Lämmel, R.: Scrap Your Boilerplate with XPath-like Combinators. In: POPL 2007: Proceedings of the 34th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 137–142 (2007)
Hejlsberg, A., et al.: Language Integrated Query (LINQ), http://msdn.microsoft.com/en-us/vbasic/aa904594.aspx
Object Management Group: Unified Modeling Language: OCL version 2.0 Final Adopted Specification. OMG Document ptc/03-10-14 edn. (October 2003)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2009 IFIP International Federation for Information Processing
About this paper
Cite this paper
Tambe, S., Gokhale, A. (2009). LEESA: Embedding Strategic and XPath-Like Object Structure Traversals in C++. In: Taha, W.M. (eds) Domain-Specific Languages. DSL 2009. Lecture Notes in Computer Science, vol 5658. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-03034-5_6
Download citation
DOI: https://doi.org/10.1007/978-3-642-03034-5_6
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-03033-8
Online ISBN: 978-3-642-03034-5
eBook Packages: Computer ScienceComputer Science (R0)