Native Primitives
Stratego -- Strategies for Program Transformation
The
prim
construct in Stratego allows calls to 'primitive' functions. This makes it easy to include external library functionality without further language extensions.
Currently (
StrategoRelease092) a primitive function can be called with a list of term arguments:
prim("foo", t1, ..., tn)
A typical example is the following
strategy definition from the
posix-process.str
module:
execvp = ?(file, argv); prim("SSL_execvp", file, argv)
which calls the
SSL_execvp
function defined in a C library, passing it the terms bound to
the variable
file
and
argv
.
It would be beneficial if primitive functions could have strategy arguments as well.
prim("foo", s1, ..., sn | t1, ..., tn)
This feature will be available in
StrategoRelease093.
--
EelcoVisser - 11 Jul 2003