MatchO - Matching Objects

What is MatchO?

MatchO provides support for matching objects within Java in the form of a Pattern interface which has various implementations for various types of objects. The underlying ideas are explained in the paper:


MatchO currently sports the following features:

  • Pattern matching on lists and arrays.
  • Pattern matching on various tree representations:
    • Antlr's abstract syntax trees (antlr.collections.AST).
    • Maximally shared annotated terms of the ATerm Library (aterm.ATerm).
    • JJTraveler's visitables (jjtraveler.Visitable).
  • Non-linear pattern matching.
  • Substitution.
  • Generic pattern-matching (covering all types mentioned above).
  • Mixing of patterns and visitors (for matching at arbitrary depths and for 'active patterns').

MatchO can be used in combination with parser generators like Antlr or JJForester to perform pattern matching on parse trees.


To learn how to use the library, see the paper.



Source distribution:

Since the full MatchO library provides matching behaviour for a range of tree representations, you might be interested in only downloading a sub-set that fits your needs. The following jars are available:

jar core dom antlr aterm jjtraveler jjforester
MatchO-2005.11.01-all.jar x x x x x x
MatchO-2005.11.01-core.jar x x        
MatchO-2005.11.01-antlr.jar x x x      
MatchO-2005.11.01-aterm.jar x x   x    
MatchO-2005.11.01-jjtraveler.jar x x     x  
MatchO-2005.11.01-jjforester.jar] x x   x x x


The following documentation is available:

  • Joost Visser, Matching Objects Without Language Extension. Accepted for publication in the Dec/Nov 2006 issue of the Journal of Object Technology. Draft version: pdf.
  • API documentation html

Previous versions

If you visited this page before November 2005, you found here previous snapshots of MatchO which is now obsolete. If you have questions about such previous versions, please contact me.

blog stats