Is their a way to display strategies (or just thier names) from within Stratego.

This could be used to add trace monitors to Stratego code.

For example:

------------------------------
I-str-detectfail-here(s) =
    s <+
    ...Display s somehow!...
------------------------------

Might be used to call strategies whose specification says they should not fail -- displaying a big warning message and the strategy name when (i mean if;) they do..

-- Bill J Ellis

There is no way to introspect a strategy at run-time to get its name (or any other analysis for that matter). What you might find useful is the strategy risky in term-io.str (in SSL), defined as:

  risky(msg, s) =
    restore(s, debug(msg))
which will print msg on failure of s (see restore in conditional.str). Thus, you can wrap the strategy that you expect to succeed with
   risky(!"strategy s should always succeed here: "), s)
One could imagine instrumenting the Stratego code such that a strategy would print its name upon request, or go into reflection mode. I'd have to think about details though.

-- EelcoVisser - 23 Jul 2003

Revision: r1.1 - 23 Jul 2003 - 22:33 - EelcoVisser
Stratego > StrategoGlossary > DisplayStrategies
Copyright © 1999-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback