Term Arguments
Stratego -- Strategies for Program Transformation
Starting with
StrategoRelease093, strategy operators can be passed terms in addition to strategies.
Currently, a strategy definition is of the form
f(s1, ..., sn) = body
where
body
is a strategy expression referring to the strategy arguments
si
.
A term can be passed to such a strategy by passing a build, e.g.,
foo(t)
.
The receiving strategy accesses the term by executing the corresponding strategy.
In certain situations, which arise for example in the compilation of strategies,
it is desirable to pass a term 'by value'. Thus, the syntax of Stratego has been
extended to allow this. A strategy definition now has the form
f(s1,..., sn | x1, ..., xm) = body
where the
xi
are term arguments of
f
, which can be referred to directly in
match and build expressions. Such an operator is called using the syntax
f(s1,...,sn|t1,...,tm)
Note that the following sugar is defined:
-
f(s1,...,sn) = body
is sugar for f(s1,...,sn|) = body
-
f = body
is sugar for f(|) = body
and similarly for rules. Corresponding sugar holds for strategy calls:
-
f(s1,...,sn)
is sugar for f(s1,...,sn|)
-
f
is sugar for f(|)
--
EelcoVisser - 23 Aug 2003