Strategy Definition

Stratego -- Strategies for Program Transformation
A strategy definition
  f(x1,...,xn) = s
defines a strategy operator f with n strategy parameters. An application f(s1,...sn) of this operator is equivalent to
  let x1 = s1 ... xn = sn in s
that is, binding the actual strategy parameters si to the formal parameters xi. Strategy definitions may be recursive.

The RecursionOperator rec can be used to create recursive strategy locally without need to give a name.

  rec x(s)
is equivalent to
  let x = s in x end

Typical examples of strategy definitions are

  try(s) = s <+ id
  repeat(s) = try(s; repeat(s))
  topdown(s) = s; all(topdown(s))

-- EelcoVisser - 08 Jan 2002


CategoryGlossary