453 research outputs found
Canonical Abstract Syntax Trees
This paper presents Gom, a language for describing abstract syntax trees and
generating a Java implementation for those trees. Gom includes features
allowing the user to specify and modify the interface of the data structure.
These features provide in particular the capability to maintain the internal
representation of data in canonical form with respect to a rewrite system. This
explicitly guarantees that the client program only manipulates normal forms for
this rewrite system, a feature which is only implicitly used in many
implementations
Efficient Pattern Matching in Python
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. 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
Verification of Timed Automata Using Rewrite Rules and Strategies
ELAN is a powerful language and environment for specifying and prototyping
deduction systems in a language based on rewrite rules controlled by
strategies. Timed automata is a class of continuous real-time models of
reactive systems for which efficient model-checking algorithms have been
devised. In this paper, we show that these algorithms can very easily be
prototyped in the ELAN system. This paper argues through this example that
rewriting based systems relying on rules and strategies are a good framework to
prototype, study and test rather efficiently symbolic model-checking
algorithms, i.e. algorithms which involve combination of graph exploration
rules, deduction rules, constraint solving techniques and decision procedures
MatchPy: A Pattern Matching Library
Pattern matching is a powerful tool for symbolic computations, based on the
well-defined theory of term rewriting systems. Application domains include
algebraic expressions, abstract syntax trees, and XML and JSON data.
Unfortunately, no lightweight implementation of pattern matching as general and
flexible as Mathematica exists for Python Mathics,MacroPy,patterns,PyPatt.
Therefore, we created the open source module MatchPy which offers similar
pattern matching functionality in Python using a novel algorithm which finds
matches for large pattern sets more efficiently by exploiting similarities
between patterns.Comment: arXiv admin note: substantial text overlap with arXiv:1710.0007
Formal Validation of Pattern Matching code
When addressing the formal validation of generated software, two main
alternatives consist either to prove the correctness of compilers or
to directly validate the generated code. Here, we focus on directly
proving the correctness of compiled code issued from powerful
pattern matching constructions typical of ML like languages or
rewrite based languages such as ELAN, MAUDE or Tom.
In this context, our first contribution is to define a general
framework for anchoring algebraic pattern-matching capabilities
in existing languages like C, Java or ML. Then, using a just enough
powerful intermediate language, we formalize the behavior of compiled
code and define the correctness of compiled code with respect to
pattern-matching behavior. This allows us to prove the equivalence of
compiled code correctness with a generic first-order proposition whose
proof could be achieved via a proof assistant or an automated theorem
prover. We then extend these results to the multi-match situation
characteristic of the ML like languages.
The whole approach has been implemented on top of the Tom compiler
and used to validate the syntactic matching code of the Tom compiler
itself
- …