Results 1 - 10
of
19
Regular expression pattern matching for XML
, 2003
"... We propose regular expression pattern matching as a core feature of programming languages for manipulating XML. We extend conventional pattern-matching facilities (as in ML) with regular expression operators such as repetition (*), alternation (|), etc., that can match arbitrarily long sequences of ..."
Abstract
-
Cited by 104 (10 self)
- Add to MetaCart
We propose regular expression pattern matching as a core feature of programming languages for manipulating XML. We extend conventional pattern-matching facilities (as in ML) with regular expression operators such as repetition (*), alternation (|), etc., that can match arbitrarily long sequences of subtrees, allowing a compact pattern to extract data from the middle of a complex sequence. We then show how to check standard notions of exhaustiveness and redundancy for these patterns. Regular expression patterns are intended to be used in languages with type systems based on regular expression types. To avoid excessive type annotations, we develop a type inference scheme that propagates type constraints to pattern variables from the type of input values. The type inference algorithm translates types and patterns into regular tree automata, and then works in terms of standard closure operations (union, intersection, and difference) on tree automata. The main technical challenge is dealing with the interaction of repetition and alternation patterns with the first-match policy, which gives rise to subtleties concerning both the termination and precision of the analysis. We address these issues by introducing a data structure representing these closure operations
Disunification: a Survey
- Computational Logic: Essays in Honor of Alan
, 1991
"... Solving an equation in an algebra of terms is known as unification. Solving more complex formulas combining equations and involving in particular negation is called disunification. With such a broad definition, many works fall into the scope of disunification. The goal of this paper is to survey the ..."
Abstract
-
Cited by 52 (9 self)
- Add to MetaCart
Solving an equation in an algebra of terms is known as unification. Solving more complex formulas combining equations and involving in particular negation is called disunification. With such a broad definition, many works fall into the scope of disunification. The goal of this paper is to survey these works and bring them together in a same framework. R'esum'e On appelle habituellement (algorithme d') unification un algorithme de r'esolution d'une 'equation dans une alg`ebre de termes. La r'esolution de formules plus complexes, comportant en particulier des n'egations, est appel'ee ici disunification. Avec une d'efinition aussi 'etendue, de nombreux travaux peuvent etre consid'er'es comme portant sur la disunification. L'objet de cet article de synth`ese est de rassembler tous ces travaux dans un meme formalisme. Laboratoire de Recherche en Informatique, Bat. 490, Universit'e de Paris-Sud, 91405 ORSAY cedex, France. E-mail: comon@lri.lri.fr i Contents 1 Syntax 5 1.1 Basic Defini...
Programming in Equational Logic: Beyond Strong Sequentiality
, 1993
"... Orthogonal term rewriting systems (also known as regular systems) provide an elegant framework for programming in equational logic. O'Donnell showed that the parallel-outermost strategy, which replaces all outermost redexes in each step, is complete for such systems. Many of the reductions performed ..."
Abstract
-
Cited by 41 (0 self)
- Add to MetaCart
Orthogonal term rewriting systems (also known as regular systems) provide an elegant framework for programming in equational logic. O'Donnell showed that the parallel-outermost strategy, which replaces all outermost redexes in each step, is complete for such systems. Many of the reductions performed by this strategy could be wasteful in general. A lazy normalization algorithm that completely eliminated these wasteful reductions by reducing only "needed redexes" was later developed by Huet and Levy. However, this algorithm required the input programs to be restricted to the subclass of strongly sequential systems. This is because needed redexes do not exist for all orthogonal programs, and even when they do, they may not be computable. It is therefore quite natural to ask whether it is possible to devise a complete normalization algorithm for the entire class that minimizes (rather than eliminate) the wasteful reductions. In this paper we propose a solution to this problem using the concept of a necessary set of redexes. In such a set, at least one of the redexes must be reduced to normalize a term. We devise an algorithm to compute a necessary set for any term not in normal form and show that a strategy that repeatedly reduces all redexes in such a set is complete for orthogonal programs. We also show that our algorithm is "optimal" among all normalization algorithms that are based on left-hand sides alone. This means that our algorithm is lazy (like Huet-Levy's) on strongly sequential parts of a program and "relaxes laziness minimally" to handle the other parts and thus does not sacrifice generality for the sake of efficiency.
Adaptive Pattern Matching
, 1992
"... Pattern matching is an important operation used in many applications such as functional programming, rewriting and rule-based expert systems. By preprocessing the patterns into a DFA-like automaton, we can rapidly select the matching pattern(s) in a single scan of the relevant portions of the inp ..."
Abstract
-
Cited by 20 (4 self)
- Add to MetaCart
Pattern matching is an important operation used in many applications such as functional programming, rewriting and rule-based expert systems. By preprocessing the patterns into a DFA-like automaton, we can rapidly select the matching pattern(s) in a single scan of the relevant portions of the input term. This automaton is typically based on left-to-right traversal of the patterns. By adapting the traversal order to suit the set of input patterns, it is possible to considerably reduce the space and matching time requirements of the automaton.
Dependently Typed Pattern Matching
- Journal of Universal Computer Science
, 2003
"... The mechanism for declaring datatypes to model data structures in functional programming languages such as Standard ML and Haskell can offer both convenience in programming and clarity in code. With the introduction of dependent datatypes in DML, the programmer can model data structures with mor ..."
Abstract
-
Cited by 15 (8 self)
- Add to MetaCart
The mechanism for declaring datatypes to model data structures in functional programming languages such as Standard ML and Haskell can offer both convenience in programming and clarity in code. With the introduction of dependent datatypes in DML, the programmer can model data structures with more accuracy, thus capturing more program invariants. In this paper, we study some practical aspects of dependent datatypes that affect both type-checking and compiling pattern matching. The results, which have already been tested, demonstrate that dependent datatype can not only offer various programming benefits but also lead to performance gains, yielding a concrete case where safer programs run faster.
The Functional Strategy and Transitive Term Rewriting Systems
, 1993
"... The functional strategy has been widely used implicitly (Haskell, Miranda, Lazy ML) and explicitly (Clean) as an efficient, intuitively easy to understand reduction strategy for term (or graph) rewriting systems. However, little is known of its formal properties since the strategy deals with priorit ..."
Abstract
-
Cited by 15 (1 self)
- Add to MetaCart
The functional strategy has been widely used implicitly (Haskell, Miranda, Lazy ML) and explicitly (Clean) as an efficient, intuitively easy to understand reduction strategy for term (or graph) rewriting systems. However, little is known of its formal properties since the strategy deals with priority rewriting which significantly complicates the semantics. Nevertheless, this paper shows that some formal results about the functional strategy can be produced by studying the functional strategy entirely within the standard framework of orthogonal term rewriting systems. A concept is introduced that is one of the key aspects of the efficiency of the functional strategy: transitive indexes . The corresponding class of transitive term rewriting systems is characterized. An efficient normalizing strategy is given for these rewriting systems. It is shown that the functional strategy is normalizing for the class of left-incompatible term rewriting systems. 1. Introduction An interesting commo...
Fast Parallel Implementation of Lazy Languages - The EQUALS Experience
- Journal of Functional Programming
, 1992
"... This paper describes equals, a fast parallel implementation of a lazy functional language on a commercially available shared-memory parallel machine, the Sequent Symmetry. In contrast to previous implementations, we detect parallelism automatically using strictness analysis. Another important differ ..."
Abstract
-
Cited by 12 (4 self)
- Add to MetaCart
This paper describes equals, a fast parallel implementation of a lazy functional language on a commercially available shared-memory parallel machine, the Sequent Symmetry. In contrast to previous implementations, we detect parallelism automatically using strictness analysis. Another important difference between equals and previous implementations is the use of reference counting for memory management, instead of garbage collection. Our implementation shows that reference counting leads to very good scalability, low memory requirements and improved locality. We compare our results with other sequential (SML/NJ) and parallel (h; Gi-machine and GAML) implementations of functional languages.
Strong Sequentiality of Left-Linear Overlapping Rewrite Systems
- Proc. of Workshop on Conditional Term Rewriting Systems, CTRS'94, LNCS 968:235-246
, 1994
"... . Confluent term rewriting systems can be seen as a model for functional computations, in which redexes corresponding to instances of left hand sides of rules are repeatedly replaced by their corresponding right hand side instance. Lazy sequential strategies reduce a given redex in a term if and onl ..."
Abstract
-
Cited by 10 (0 self)
- Add to MetaCart
. Confluent term rewriting systems can be seen as a model for functional computations, in which redexes corresponding to instances of left hand sides of rules are repeatedly replaced by their corresponding right hand side instance. Lazy sequential strategies reduce a given redex in a term if and only if this redex must be reduced by any other sequential strategy computing the normal form of the term. Lazy strategies always terminate when a normal form exist, and are indeed optimal. In a landmark paper, Huet and Levy showed that such a strategy always exists for left linear nonoverlapping rewrite systems that are strongly sequential, a property that they proved decidable for such systems. This paper generalises the result to the case of left-linear, possibly overlapping rewrite systems. 1 Introduction Confluent term rewriting systems can be seen as a model for functional computations, in which redexes corresponding to instances of left hand sides of rules are repeatedly replaced by the...
Two Techniques for Compiling Lazy Pattern Matching
, 1994
"... In ML style pattern matching, pattern size is not constrained and ambiguous patterns are allowed. This generality leads to a clear and concise programming style but is challenging in the context of lazy evaluation. A first challenge concerns language designers: in lazy ML, the evaluation order of ex ..."
Abstract
-
Cited by 10 (1 self)
- Add to MetaCart
In ML style pattern matching, pattern size is not constrained and ambiguous patterns are allowed. This generality leads to a clear and concise programming style but is challenging in the context of lazy evaluation. A first challenge concerns language designers: in lazy ML, the evaluation order of expressions follows actual data dependencies. That is, only the computations that are needed to produce the final result are performed. Once given a proper (that is, non-ambiguous) semantics, pattern matching should be compiled in a similar spirit: any value matching a given pattern should be recognized by performing only the minimal number of elementary tests needed to do so. This challenge was first met by A. Laville. A second challenge concerns compiler designers. As it stands, Laville's compilation algorithm cannot be incorporated in an actual lazy ML compiler for efficiency and completeness reasons. As a matter of fact, Laville's original algorithm did not fully treat the case of intege...
ML pattern match compilation and partial evaluation
, 1996
"... : We derive a compiler for ML-style pattern matches. It is conceptually simple and produces reasonably good compiled matches. The derivation is inspired by the instrumentation and partial evaluation of naive string matchers. Following that paradigm, we first present a general and naive ML pattern ma ..."
Abstract
-
Cited by 10 (1 self)
- Add to MetaCart
: We derive a compiler for ML-style pattern matches. It is conceptually simple and produces reasonably good compiled matches. The derivation is inspired by the instrumentation and partial evaluation of naive string matchers. Following that paradigm, we first present a general and naive ML pattern matcher, instrument it to collect and exploit extra information, and show that partial evaluation of the instrumented general matcher with respect to a given match produces an efficient specialized matcher. We then discard the partial evaluator and show that a match compiler can be obtained just by slightly modifying the instrumented general matcher. The resulting match compiler is interesting in its own right, and naturally detects inexhaustive matches and redundant match rules. 1 Introduction Consel and Danvy [3] studied a general string matcher, taking two inputs: a pattern string to look for, and an object string to look in. The matcher finds the first occurrence (if any) of the pattern ...

