Efficient Pattern Matching in Python

Manuel Krebber, Henrik Barthels, Paolo Bientinesi
9/29/2017
cs.PLcs.PF

Official code: HPAC/matchpy (174 stars, Python, MIT, last commit 2024-04-18).

Abstract

Pattern matching is a powerful tool for symbolic computations. Applications include term rewriting systems, as well as the manipulation of symbolic expressions, abstract syntax trees, and XML and JSON data.

Show full abstract

It also allows for an intuitive description of algorithms in the form of rewrite rules. We present the open source Python module MatchPy, which offers functionality and expressiveness similar to the pattern matching in Mathematica. In particular, it includes syntactic pattern matching, as well as matching for commutative and/or associative functions, sequence variables, and matching with constraints. MatchPy uses new and improved algorithms to efficiently find matches for large pattern sets by exploiting similarities between patterns. The performance of MatchPy is investigated on several real-world problems.

View on arXivView PDF

Code Implementations(1)

HPAC/matchpyOfficial100%
MIT

A library for pattern matching on symbolic expressions in Python.

17426Python, TeXAug 25, 20162 years agoMIT
pattern-matchingpythonsymbolic-expressionsterm-rewriting

Similar Papers

Cite this paper

@article{krebber2017efficient,
  title  = {Efficient Pattern Matching in Python},
  author = {Manuel Krebber and Henrik Barthels and Paolo Bientinesi},
  year   = {2017},
  eprint = {1710.00077},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/1710.00077}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/1710.00077.svg)](https://codeofpaper.com/paper/1710.00077)

Discussion