Results 1 -
1 of
1
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 ...

