next up previous contents
Next: Single source path problems Up: Other kinds of rules Previous: Non-ground facts

Verbose syntax for rules

Rule preconditions may be written in a more verbose way than Datalog offers. Together with linear path expressions this gives a clear way to specify preconditions and actions in certain situations. Consider the specification which is equivalent to the previous available expression dataflow analysis:

// Find available expressions
ears AvailableExpressions ()
{  range b <= AVIN; e <= AVIN.TARGET;
   e in b.AVIN;    
   e in b.AVOUT; 
   if FORALL p: BlockGraph(b,p), AVOUT(p,e) then AVIN(b,e);
   if COMPOUT(b,e)                          then AVOUT(b,e);
   if TRANSP(b,e), AVIN(b,e)                then AVOUT(b,e);
}

Consider the following, equivalent version with path expressions which is even more concise:

// Find available expressions
ears AvailableExpressions ()
{  range b <= AVIN; e <= AVIN.target;
   e in b.AVIN;    
   e in b.AVOUT; 
   if FORALL p: p in b.BlockGraph, e in p.AVOUT then e in b.AVIN;
   if e in b.COMPOUT                            then e in b.AVOUT;
   if e in b.TRANSP and e in b.AVIN             then e in b.AVOUT;
}



Uwe Assmann
1998-12-22