The purpose of syntactic matching is to rapidly eliminate from consideration those modules in the software base that cannot match the query specification's interface. This matching process [McDo 91] uses the type information in query module's PSDL interface specification to formulate a query.
The attributes of a PSDL specification p for a software component c that are important to the syntactic matching process are the following:
S(p)= ({In(t, n) : there are n>0 occurrences of type t as input parameters to c },
{Out(t, m) : there are m>0 occurrences of type t as output parameters from c },
{E : E is an exception defined in c},
{St : St is a state variable in c} )
S(p) is the interface subset of the PSDL specification for module c and is the only part of the specification that pertains to the syntactic matching process.
Given a software base module c, and a query module q, along with their respective PSDL interface specifications S[c] and S[q] c is a syntactic match for q if and only if all of the following constraints are met:
(1) Exists f[i] : S[q] –> S[c] such that
(In[q](t, n)) = In[c](t', m)
and m = n
and (t = t' or t' is a generic match of t)
and f[i] is bijective]
(2) Exists f[o] : S[q] –> S[c] such that
(Out[q](t, n)) = Out[c](t', m)
and m = n
and (t = t' or t' is a generic match of t)
and f[o] is injective]
(3) if |ST[q]| > 0 then |ST[m]| > 0 else (|ST[q]| = 0
= |ST[m]|)
To improve efficiency, we use the matching rules to derive a set of module attributes that can be used to rapidly identify and reject modules with unsuitable interfaces. Some examples of these derived attributes include:
If the number of input parameters in S[q] is not equal to the number input parameters in S[c], then there can be no function f[i] to satisfy rule 1. Therefore S[c] can be eliminated from the search.
If the number of output parameters in S[q] is greater than the number of output parameters in S[c], then there can be no function f[o] to satisfy rule 2. Therefore S[c] can be eliminated from the search.
If S[q] has state variables defined (i.e. q defines a state machine) but S[c] has no state variables, then S[c] can be eliminated from the search.
The rules for the syntactic matching of type modules are similar to those for operator modules with the addition of a mapping function to map the operators of S[q] to the operators of S[c] and an additional check to ensure the generic parameter substitutions used for this mapping function are consistent for all operators in S[c].