Matchete: Paths through the Pattern Matching Jungle

  • Martin Hirzel
  • Nathaniel Nystrom
  • Bard Bloom
  • Jan Vitek
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4902)

Abstract

Pattern matching is a programming language feature for selecting a handler based on the structure of data while binding names to sub-structures. By combining selection and binding, pattern matching facilitates many common tasks such as date normalization, red-black tree manipulation, conversion of XML documents, or decoding TCP/IP packets. Matchete is a language extension to Java that unifies different approaches to pattern matching: regular expressions, structured term patterns, XPath, and bit-level patterns. Matchete naturally allows nesting of these different patterns to form composite patterns. We present the Matchete syntax and describe a prototype implementation.

Keywords

Pattern matching regular expressions XPath binary data formats Java 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Back, G.: DataScript: A specification and scripting language for binary data. In: Batory, D., Consel, C., Taha, W. (eds.) GPCE 2002. LNCS, vol. 2487, Springer, Heidelberg (2002)CrossRefGoogle Scholar
  2. 2.
    Benzaken, V., Castagna, G., Frisch, A.: CDuce: An XML-centric general-purpose language. In: International Conference on Functional Programming (ICFP) (2003)Google Scholar
  3. 3.
    Clark, J., DeRose, S.: XML path language (XPath) version 1.0. W3C recommendation, W3C (November 1999), http://www.w3.org/TR/1999/REC-xpath-19991116
  4. 4.
    Diatchki, I.S., Jones, M.P., Leslie, R.: High-level views on low-level representations. In: International Conference on Functional Programming (ICFP) (2005)Google Scholar
  5. 5.
    Emir, B., Odersky, M., Williams, J.: Matching objects with patterns. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, Springer, Heidelberg (2007)CrossRefGoogle Scholar
  6. 6.
    Field, R.: JSR 45: Debugging Support for Other Languages, http://jcp.org
  7. 7.
    Fisher, K., Gruber, R.: PADS: A domain-specific language for processing ad hoc data. In: Programming Language Design and Implementation (PLDI) (2005)Google Scholar
  8. 8.
    Gapeyev, V., Pierce, B.C.: Regular object types. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743, Springer, Heidelberg (2003)Google Scholar
  9. 9.
    Gosling, J., Joy, B., Steele, G., Bracha, G.: The Java Language Specification, 2nd edn. Addison-Wesley, Reading (2000)Google Scholar
  10. 10.
    Grimm, R.: xtc (eXTensible C), http://cs.nyu.edu/rgrimm/xtc/
  11. 11.
    Grimm, R.: Better extensibility through modular syntax. In: Programming Language Design and Implementation (PLDI) (2006)Google Scholar
  12. 12.
    Griswold, R., Poage, J.F., Polonsky, I.P.: The Snobol 4 Programming Language. Prentice-Hall, Englewood Cliffs (1971)Google Scholar
  13. 13.
    Guibas, L.J., Sedgewick, R.: A dichromatic framework for balanced trees. In: Foundations of Computer Science (FOCS) (1978)Google Scholar
  14. 14.
    Gustafsson, P., Sagonas, K.: Efficient manipulation of binary data using pattern matching. Journal on Functional Programming (JFP) (2006)Google Scholar
  15. 15.
    Harren, M., Raghavachari, M., Shmueli, O., Burke, M.G., Bordawekar, R., Pechtchanski, I., Sarkar, V.: XJ: Facilitating XML processing in Java. In: International World Wide Web Conferences (WWW) (2005)Google Scholar
  16. 16.
    Hosoya, H., Pierce, B.: XDuce: A statically typed XML processing language. Transactions on Internet Technology (TOIT) (2001)Google Scholar
  17. 17.
    Hudak, P., Peyton Jones, S.L., Wadler, P., Boutel, B., Fairbairn, J., Fasel, J.H., Guzmán, M.M., Hammond, K., Hughes, J., Johnsson, T., Kieburtz, R.B., Nikhil, R.S., Partain, W., Peterson, J.: Report on the programming language Haskell, a non-strict, purely functional language. SIGPLAN Notices 27(5), R1–R164 (1992)Google Scholar
  18. 18.
    Kirkegaard, C., Møller, A., Schwartzbach, M.I.: Static analysis of XML transformations in Java. IEEE Transactions on Software Engineering (TSE) (2004)Google Scholar
  19. 19.
    Lee, K., LaMarca, A., Chambers, C.: HydroJ: Object-oriented pattern matching for evolvable distributed systems. In: Object-Oriented Programming, Systems, Languages and Applciations (OOPSLA) (2003)Google Scholar
  20. 20.
    Liu, J., Myers, A.C.: JMatch: Iterable abstract pattern matching for Java. In: Dahl, V., Wadler, P. (eds.) PADL 2003. LNCS, vol. 2562, Springer, Heidelberg (2002)Google Scholar
  21. 21.
    Meijer, E., Beckman, B., Bierman, G.M.: LINQ: Reconciling objects, relations, and XML in the .NET framework. In: SIGMOD Industrial Track (2006)Google Scholar
  22. 22.
    Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML (Revised). MIT Press, Cambridge (1997)Google Scholar
  23. 23.
    Moreau, P.-E., Ringeissen, C., Vittek, M.: A pattern matching compiler for multiple target languages. In: Hedin, G. (ed.) CC 2003 and ETAPS 2003. LNCS, vol. 2622, Springer, Heidelberg (2003)Google Scholar
  24. 24.
    Okasaki, C.: Purely Functional Data Structures. Cambridge University Press, Cambridge (1998)Google Scholar
  25. 25.
    Richard, A.J.: OOMatch: Pattern matching as dispatch in Java. Master’s thesis, University of Waterloo (2007)Google Scholar
  26. 26.
    Syme, D., Neverov, G., Margetson, J.: Extensible pattern matching via a lightweight language extension. In: International Conference on Functional Programming (ICFP) (2007)Google Scholar
  27. 27.
    Wadler, P.: Views: A way for pattern matching to cohabit with data abstraction. In: Principles of Programming Languages (POPL) (1987)Google Scholar
  28. 28.
    Wall, L.: Programming Perl. O’Reilly (1990)Google Scholar
  29. 29.
    Wright, A.K.: Pattern matching for Scheme. The match special form is part of PLT Scheme’s MzLib library (1996)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2007

Authors and Affiliations

  • Martin Hirzel
    • 1
  • Nathaniel Nystrom
    • 1
  • Bard Bloom
    • 1
  • Jan Vitek
    • 1
    • 2
  1. 1.IBM Watson Research Center, 19 Skyline Drive, Hawthorne, NY 10532USA
  2. 2.Dpt. of Computer SciencePurdue UniversityWest LafayetteUSA

Personalised recommendations