Advertisement

Compilation of Generic Regular Path Expressions Using C++ Class Templates

  • Luca Padovani
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3443)

Abstract

Various techniques for the navigation and matching of data structures using path expressions have been the subject of extensive investigations. No matter whether such techniques are based on type information, indexing, automata, it is desirable to synthesize implementations automatically, starting from a high-level description of the path expressions to be traversed.

In this paper we present a library of C++ templates for the representation of regular path expressions and their compilation into efficient backtracking algorithms. The resulting code can be used to implement visitors, pattern matchers, node collectors on regular paths over possibly heterogeneous, linked data structures.

The point of the paper is on the path compilation technique, which was inspired by a continuation-passing, functional semantics of the path expressions. We rely on some peculiar aspects of C++ templates to create a compilation framework that closely follows the given semantics.

Keywords

Denotational Semantic Tree Automaton Path Expression Walk Method XPath 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.

References

  1. 1.
    Stoy, J.E.: Denotational Semantics: The Scott-Strachey Approach to Programming Language Semantics. MIT Press, Cambridge (1977)Google Scholar
  2. 2.
    Schmidt, D.A.: Denotational Semantics: A Methodology for Language Development. Wm. C. Brown Publishers (1988)Google Scholar
  3. 3.
    Appel, A.: Compiling with Continuations. Cambridge University Press, Cambridge (1992)Google Scholar
  4. 4.
    Veldhuizen, T.: Using C++ Template Metaprograms. C++ Report 7(4), 36–43 (1995)Google Scholar
  5. 5.
    Veldhuizen, T.: Expression Templates. C++ Report 7(5), 26–31 (1995)Google Scholar
  6. 6.
    Myers, N.: A new and useful template technique: Traits. C++ Report 7(5), 33–35 (1995)Google Scholar
  7. 7.
    Coplien, J.O.: Curiously Recurring Template Patterns. In: Lippman, S.B. (ed.) C++ Gems, pp. 135–144. Cambridge University Press, New York (1996)Google Scholar
  8. 8.
    Jones, N.D.: An introduction to partial evaluation. ACM Computing Surveys 28(3), 480–503 (1996)CrossRefGoogle Scholar
  9. 9.
    Veldhuizen, T.: C++ templates as partial evaluation. In: ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipula-tion (PEPM 1998), San Antonio, TX, USA, January 1999, pp. 13–18 (1999)Google Scholar
  10. 10.
    Wadler, P.: A formal semantics of patterns in XSLT. In: Tommie Usdin, B., Lapeyre, D.A., Sperberg-McQueen, C.M. (eds.) Proceedings of Markup Technologies, Philadelphia (1999)Google Scholar
  11. 11.
    Clark, J., DeRose, S.: XML Path Language (XPath). W3C Recommendation (1999), http://www.w3.org/TR/xpath
  12. 12.
    Comon, H., Dauchet, M., Gilleron, R., Jacquemard, F., Lugiez, D., Tison, S., Tommasi, M.: Tree Automata Techniques and Applications (1999), http://www.grappa.univ-lille3.fr/tata
  13. 13.
    Eisenecker, U.W., Czarnecki, K.: Generative Programming: Methods, Tools, and Applications. Addison-Wesley, Reading (2000)Google Scholar
  14. 14.
    Mcnamara, B., Smaragdakis, Y.: Functional Programming in C++ using the FC++ Library. ACM SIGPLAN Notices 36(4), 25–30 (2001)CrossRefGoogle Scholar
  15. 15.
    Hosoya, H., Pierce, B.: Regular expression pattern matching for XML. In: Proceedings of the 28th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 67–80 (2001)Google Scholar
  16. 16.
    Mcnamara, B., Smaragdakis, Y.: Functional Programming with the FC++ Library. under consideration for publication in Journal of Functional Programming (July 2002)Google Scholar
  17. 17.
    Clark, J., DeRose, S.: XML Path Language (XPath) 2.0. W3C Working Draft (2002), http://www.w3.org/TR/xpath20
  18. 18.
    Vandevoorde, D., Josuttis, N.M.: C++ Templates: The Complete Guide. Addison-Wesley, Reading (2002)Google Scholar
  19. 19.
    Boag, S., et al.: XQuery 1.0: An XML Query Language. W3C Working Draft (November 2003), http://www.w3.org/TR/xquery/
  20. 20.
    Neumann, A., Berlea, A., Seidl, H.: fxgrep, The Functional XML Querying Tool, http://www.informatik.uni-trier.de/~aberlea/Fxgrep/
  21. 21.
    Leroy, X., et al.: Objective Caml, http://caml.inria.fr/ocaml/

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Luca Padovani
    • 1
  1. 1.Department of Computer ScienceUniversity of BolognaBolognaItaly

Personalised recommendations