JMatch: Iterable Abstract Pattern Matching for Java

  • Jed Liu
  • Andrew C. Myers
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2562)


The JMatch language extends Java with iterable abstract pattern matching, pattern matching that is compatible with the data abstraction features of Java and makes iteration abstractions convenient. JMatch has ML-style deep pattern matching, but patterns can be abstract; they are not tied to algebraic data constructors.A single JMatch method may be used in several modes; modes may share a single implementation as a boolean formula. Modal abstraction simplifies specification and implementation of abstract data types. This paper describes the JMatch language and its implementation.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [ABPS98]
    Krzysztof R. Apt, Jacob Brunekreef, Vincent Partington, and Andrea Schaerf. Alma-0: An imperative language that supports declarative programming. ACM Transactions on Programming Languages and Systems, 20(5):1014–1066, September 1998.CrossRefGoogle Scholar
  2. [BC93]
    F.W. Burton and R. D. Cameron. Pattern matching with abstract data types. Journal of Functional Programming, 3(2):171–190, 1993.MathSciNetCrossRefGoogle Scholar
  3. [CL00]
    K. Claessen and P. Ljungl. Typed logical variables in Haskell. In Haskell Workshop 2000, 2000.Google Scholar
  4. [CLR90]
    Thomas A. Cormen, Charles E. Leiserson, and Ronald L. Rivest. Introduction to Algorithms. MIT Press, 1990.Google Scholar
  5. [Con63]
    Melvin E. Conway. Design of a separable transition-diagram compiler. Communications of the ACM, 6(7):396–408, 1963.MATHCrossRefGoogle Scholar
  6. [EKC98]
    Michael Ernst, Craig Kaplan, and Craig Chambers. Predicate dispatching: A unified theory of dispatch. In 12th European Conference on Object-Oriented Programming, pages 186–211, Brussels, Belgium, July 1998.Google Scholar
  7. [FB97]
    Manuel Fähndrich and John Boyland. Statically checkable pattern abstractions. In Proc. 2nd ACM SIGPLAN International Conference on Functional Programming (ICFP), pages 75–84, June 1997.Google Scholar
  8. [FR99]
    Remi Forax and Gilles Roussel. Recursive types and pattern matching in java. In Proc. International Symposium on Generative and Component-Based Software Engineering (GCSE’ 99), Erfurt, Germany, September 1999. LNCS 1799.Google Scholar
  9. [GHK81]
    Ralph E. Griswold, David R. Hanson, and John T. Korb. Generators in ICON. ACM Transaction on Programming Languages and Systems, 3(2), April 1981.Google Scholar
  10. [GJS96]
    James Gosling, Bill Joy, and Guy Steele. The Java Language Specification. Addison-Wesley, August 1996. ISBN 0-201-63451-1.Google Scholar
  11. [Gre87]
    Steven Gregory. Parallel Programming in PARLOG. Addison-Wesley, 1987.Google Scholar
  12. [Han97]
    Michael Hanus. A unified computation model for functional and logic programming. In Proc. 24th ACM Symp. on Principles of Programming Languages (POPL), pages 80–93, Paris, France, January 1997.Google Scholar
  13. [HFW86]
    C. T. Haynes, D. P. Friedman, and M. Wand. Obtaining coroutines from continuations. Journal of Computer Languages, 11(3-4):143–153, 1986.MATHCrossRefGoogle Scholar
  14. [HJW92]
    Paul Hudak, Simon Peyton Jones, and Philip Wadler. Report on the programming language Haskell. SIGPLAN Notices, 27(5), May 1992.Google Scholar
  15. [JMG+02]
    Trevor Jim, Greg Morrisett, Dan Grossman, Michael Hicks, James Cheney, and Yanling Wang. Cyclone: A safe dialect of C. In Proceedings of the USENIX Annual Technical Conference, pages 275–288, Monterey, CA, June 2002. See also
  16. [L+81]
    B. Liskov et al. CLU reference manual. In Goos and Hartmanis, editors, Lecture Notes in Computer Science, volume 114. Springer-Verlag, Berlin, 1981.Google Scholar
  17. [Llo99]
    John W. Lloyd. Programming in an integrated functional and logic programming language.Journal of Functional and Logic Programming, 3, March 1999.Google Scholar
  18. [LM02]
    Jed Liu and Andrew C. Myers. JMatch: Java plus pattern matching. Technical Report TR2002-1878, Computer Science Department, Cornell University, October 2002. Software release at
  19. [Mic01]
    Microsoft Corporation. Microsoft C# Language Specifications. Microsoft Press, 2001. ISBN 0-7356-1448-2.Google Scholar
  20. [MOSS96]
    Stephan Murer, Stephen Omohundro, David Stoutamire, and Clemens Szyperski. Iteration abstraction in Sather. ACM Transactions on Programming Languages and Systems, 18(1):1–15, January 1996.CrossRefGoogle Scholar
  21. [MTH90]
    Robin Milner, Mads Tofte, and Robert Harper. The Definition of Standard ML. MIT Press, Cambridge, MA, 1990.Google Scholar
  22. [NCM02]
    Nathaniel Nystrom, Michael Clarkson, and AndrewC. Myers. Polyglot:An extensible compiler framework for Java. Technical Report 2002-1883, Computer Science Dept., Cornell University, 2002.Google Scholar
  23. [Nel91]
    Greg Nelson, editor. Systems Programming with Modula-3. Prentice-Hall, 1991.Google Scholar
  24. [Oka98a]
    Chris Okasaki. Purely Functional Data Structures. Cambridge University Press, 1998. ISBN 0-521-63124-6.Google Scholar
  25. [Oka98b]
    Chris Okasaki. Views for Standard ML. InWorkshop on ML, pages 14–23, September 1998.Google Scholar
  26. [OW97]
    Martin Odersky and Philip Wadler. Pizza into Java: Translating theory into practice. In Proc. 24th ACM Symp. on Principles of Programming Languages (POPL), pages 146–159, Paris, France, January 1997.Google Scholar
  27. [PGPN96]
    Pedro Palao Gostanza, Ricardo Pena, and Manuel Núñez. A new look at pattern matching in abstract data types. In Proc. 1st ACMSIGPLAN International Conference on Functional Programming (ICFP), Philadelphia, PA, USA, June 1996.Google Scholar
  28. [SHC96]
    Zoltan Somogyi, Fergus Henderson, and Thomas Conway. The execution algorithm of Mercury: an efficient purely declarative logic programming language. Journal of Logic Programming, 29(1-3):17–64, October-December 1996.MATHCrossRefGoogle Scholar
  29. [Tul00]
    Mark Tullsen. First-class patterns. In Proc. Practical Aspects of Declarative Languages, 2nd International Workshop (PADL), pages 1–15, 2000.Google Scholar
  30. [Wad87]
    Philip Wadler. Views: A way for pattern matching to cohabit with data abstraction. In Proceedings, 14th Symposium on Principles of Programming Languages, pages 307–312. Association for Computing Machinery, 1987.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Jed Liu
    • 1
  • Andrew C. Myers
    • 1
  1. 1.Computer Science DepartmentCornell UniversityIthaca NewYork

Personalised recommendations