We propose a practical technique to compile left-to-right pattern-matching of prioritised overlapping function definitions in equational languages to a matching automaton from which efficient code can be derived. First, a matching table is constructed using a compilation method similar to the technique that YACC employs to generate parsing tables. The matching table obtained allows for the pattern-matching process to be performed without any backtracking. Then, the known information about right sides of the equations is inserted in the matching table in order to speed-up the pattern-matching process. Most of the discussion assumes that the processed pattern set is left-linear, the non-linear case being handled by an additional pass following the matching stage.Usually, the pattern set is pre-processed producing an intermediate representation allowing for the matching process to be performed efficiently. Different kinds of such representations have been studied: conditional constructs, like those in procedural languages, have been exploited for this purpose. Examples include the if-then-else construct [5] and the caseexpression [6,7]. Another kind of representation consists of a matching tree (also called the index tree) [3,8]. Similarly, pattern-matching definitions have been compiled into a finite matching automaton in References [1,9,10,11,12].Pattern-matching automata have been studied for over a decade. Gräf [9], Maranget [13] and Christian [14] describe matching automata for unambiguous patterns based on left-toright traversal. Gräf [9] adds instances of patterns using a closure operation, so symbol re-examination could be avoided. Maranget [13] describes two techniques to compile lazy pattern-matching. The first technique generates a deterministic matching automaton that is equivalent to that obtained by Gräf [9]. The second technique, however, generates automata with failures that allow non-deterministic pattern-matching (i.e. with symbol re-examination). These automata possess a static exception construct that enables some code sharing. In functional programming, Augustsson [6] and Wadler [7] describe patternmatching techniques that are also based on left-to-right traversal, but allow prioritised overlapping patterns. They compile patterns into CASE constructs using four compilation rules: the empty rule, the constructor rule, the variable rule and the mixture rule. Although the latter methods are practical and economical in terms of space usage, they may re-examine symbols in the input term. In the worst case, these methods can degenerate to the naive method of checking the input term against each pattern individually. In contrast, Christian's [14] and Gräf's [9] methods, together with Maranget's [13] first technique, avoid symbol reexamination at the cost of increasing the space requirements, while Maranget's [13] second technique guarantee that the size the resulting automaton is linear in the size of the patterns. However, one has to bear in mind that the functional approach followed by Wadler [7] and...