Next: Algorithm for Auto-completion and
Up: Auto-completion and Auto-update Mechanism
Previous: Modeling Language: Syntax and
Sometimes, it is possible to define predicates from other primitive
predicates by using a IF-THEN-ELSE construct. Note that each
predicate is
defined as a three-tuple
A, C , 
.
An abstract syntax of if-then-else construct can be described as:
if
then
else
where,
= (
,
,
),
= (
,
,
),
= (
,
,
),and
= (
,
,
).
The argument-list
of the composed predicate
is given by:
Any evaluation of check-code C is a mapping
: C
.
Therefore, the evaluation of check-code
of the composed
predicate
is defined as :
The auto-completion rules
of the resultant predicate
can be defined as:
where,
= {
,
, ....,
} ,
= {
,
, ....,
}, and
= {
,
,....,
,
,....,
}
The operation
is a union of auto-completion rules
that are transformed as described below.
For
the transformation is defined as :
:
Consider a rule
= (
,
,
,
,
)
and the transformed rule
= (
,
,
,
,
).
It is clear from above that only the guards are affected by the
transformation
.
Let
and
denote the expression tree associated
with guard
and
respectively, then the transformation on guards
is given as:
where ,
: C
T creates a new expression
tree. The binary operator
returns a new
expression tree
with a boolean operator and as a non-terminal node and
operands(to
the function) as
children to this node. This transformation ensures that
all calls to JavaScript functions are still in the terminal nodes.
Similarly, consider a rule
= (
,
,
,
,
)
and the transformed rule
= (
,
,
,
,
).
Here again only the guards are affected by the transformation
.
For
the transformation is
defined as :
:
Let
and
denote the expression tree associated
with guard
and
respectively, then the transformation on guards
is given as:
where,
the function
and the operator
have
already been described above.
The relation between
and
is given by:
Based on the above transformations, Figure 6 shows a
concrete
example of a predicate being composed from a number of
primitive predicates.
Figure 6:
Composing predicates from primitive predicates.
|
|
We can generalise the condition part of IF-THEN-ELSE construct
from a single predicate reference to a full predicate expression
by specifying a boolean expression tree as described in
Section 4.3. This gives greater expressive power to our
formalism but in most cases a single predicate reference
will suffice.
Next: Algorithm for Auto-completion and
Up: Auto-completion and Auto-update Mechanism
Previous: Modeling Language: Syntax and
Sunil Kothari
2006-04-29