Represent Strategy As Term

Stratego -- Strategies for Program Transformation
By representing a strategy as a term, it can be passed around. This requires an EvalStrategy? operator that evaluates such a term. This need not be a primitive;

Problems

  • How to distinghuish congruence strategies represented as terms from terms themselves?

  • By declaring constructors for the strategies, a congruence operator is declared automatically. This should be avoided. That is, the user should not declare these constructors, but they should be generated implicitly from strategy definitions.

  • Closures?

-- EelcoVisser - 27 Oct 2001

A possibility is to use a quotation mechanism in the style of MetaML and represent quoted stategies internally using abstract syntax representation. This requires an interpreter that maps calls to strategy operators, but has to interprete ordinary combinators. This would make possible an integration of the interpreter StrategoScript? with the StrategoCompiler. In fact, StrategoScript? already calls C functions, i.e., the Stratego primitives from the Stratego standard library?.

ELAN provides such a mechanism. The idea of RewritingByRewriting? is based on this idea, if I remember correctly.

-- EelcoVisser - 02 Nov 2001


CategoryToDo? | ToDo | LanguageExtensions