rtg2sig

Summary

Generates a Stratego Signature from an RTG.

Options

   --module n       Generated module has name n
   -i f|--input f   Read input from f
   -o f|--output f  Write output to f

Example

Consider the RTG that is produced by the example in sdf2rtg.

  regular tree grammar
    start Exp
    productions
      Exp      -> Minus(Exp,Exp)
      Exp      -> Plus(Exp,Exp)
      Exp      -> Mod(Exp,Exp)
      Exp      -> Div(Exp,Exp)
      Exp      -> Mul(Exp,Exp)
      Exp      -> Int(IntConst)
      Exp      -> Var(Id)
      IntConst -> <string>
      Id       -> <string>

Invoke rtg2sig:

  > rtg2sig -i Exp.rtg -o Exp.str
I you don't specify an output file, then you need to specify the desired module name with the --module option.

The result is the following Stratego module:

  module Exp
  imports list-cons option
  signature
    constructors
      Minus : Exp * Exp -> Exp
      Plus  : Exp * Exp -> Exp
      Mod   : Exp * Exp -> Exp
      Div   : Exp * Exp -> Exp
      Mul   : Exp * Exp -> Exp
      Int   : IntConst -> Exp
      Var   : Id -> Exp
            : String -> IntConst
            : String -> Id

This Stratego module can be imported in you Stratego transformation tool.

Revision: r1.2 - 28 Apr 2005 - 22:24 - Main.wiki
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