Stratego Regular

Stratego -- Strategies for Program Transformation


Stratego Regular is a package of tools for working with tree languages. A tree language is a set of trees define by a tree grammar. Stratego Regular defines the concrete and abstract syntax of RTG, a language for regular tree grammars, and RHG, a language for regular hedge grammars?. The RTG and RHG languages are used to define tree languages.

Applications of the RHG and RTG languages:

  • RTG is used as a better and reusable implementation of sdf-to-sig?. This transformation is split into two separate tools: sdf2rtg and rtg2sig.
  • Interpretation of XML against a schema in some schema language for XML is an important component of xml-tools. Interpretation is performed against an RHG and tools will implement the conversion of schemas (DTD, RELAX NG, W3C XML Schema) to RHG.
  • A future release of XTC will support contracts, which define the input and output term of a tool. These contracts are be defined in the RTG language.


  • sdf2rtg? -- generates an abstract syntax definition in RTG from an SDF syntax definition.
  • rtg2sig -- generates a Stratego signature from an abstract syntax definition in RTG.
  • format-check? -- Check if an ATerm is part of the language defined by an RTG.
  • rtg2typematch -- Generates a duck-typing based strategy that checks if an ATerm is of a type defined in an RTG.

Download and Installation

Stratego Regular is part of StrategoXT from release 0.10.