Introduction
stratego-misc is a small, but versatile package of Stratego modules, implementing strategies and tools that are not (yet) in the SSL.
It might be handy for others as well, so here it is, online.
Contained modules
Currently, stratego-misc consists of the following modules:
- term-color: Produce color output in your terminal, directly from Stratego! Very cool indeed, handy as well. Distinguish the various parts in the usually huge Term-dumps, while debugging, by colorizing them.
- output-control: Improved control over (debug-) output. More intuitive verbosity levels and nested, tree-like debug-output.
- dynamic-rules-tools: A first approach towards generalizing the various strategies that operate on dynamic rules and the tables behind them. Also a (debugging-) pretty printer for dynamic rules.
Module term-color
Produce color output in your terminal, directly from Stratego! Very cool indeed, handy as well. Distinguish the various parts in the usually huge Term-dumps, while debugging, by colorizing them.
Sample output (in a regular terminal):
Module output-control
Improved control over (debug-) output. More intuitive verbosity levels and nested, tree-like debug-output.
Sample output when using so-called output-nests (in a regular terminal):
Usage
Use
output-nest(s|text)
for entering a new output-level.
HandleFunTpSpec =
output-nest(
?FunTpSpec(f, tpF)
; rules(Id2Type: f -> tpF)
| "HandleFunTpSpec")
Use
on-debug(|color, text)
instead of debug:
<on-debug(|tc-green, "argtypes: ")> tpV'*
The equivalent of
say
is also available:
on-say(|color, text)
.
Verbosity
output-control checks whether the
--verbose
flag was set, and defaults to 0 otherwise. The possible levels are:
lvlError = 0 // not used
lvlInfo = 1 // not used
lvlTalkative = 2 // print entering and exiting of output-nests
lvlChatty = 3 // id. and print input and output terms of each output-nest
lvlDebug = 4 // id. and show any on-debug/on-say output
lvlVomit = 5 // not used
Practical usage
Make sure your toplevel strategy supports the
--verbosity
flag (using
io-wrap
,
output-wrap
, or otherwise).
When piping your program output into
less
, make sure
stderr
is redirected into
stdout
and
less
is called with color-support:
[adam@madras:lib>
parse-tfof -i test1.tfof | ./TFOF-InferTypes --verbose 4 2>&1 | less -R
Module dynamic-rules-tools
This has been superseded by
dynamic-rules-refactored
in the SSL, since the introduction of the new dynamic rules in
Stratego 0.10.
Documentation
Generated documentation by
xdoc can be found at
http://catamaran.labs.cs.uu.nl/docs/stratego-misc/api/
Download and Installation
Interested in using stratego-misc yourself? You can download the latest working distribution (tar.bz2) here:
stratego-misc-head.tar.gz
Unpack the tarball and configure the package with the usual --with-strategoxt, --with-sdf and --with-aterm.
See the INSTALL file for detailed instructions.
--
ArthurVanDam - 02 Feb 2004