Gen Renamed Sdf Module

XT -- A Bundle of Program Transformation Tools

Introduction

gen-renamed-sdf-module generates an SDF module that renames all SDF sorts in a given SDF definition.

Example

Syntax definition:

definition
module Expressions
imports Identifiers [Id => MyId]
  exports
    sorts Exp

    context-free syntax
      Id        -> Exp {cons("Var")}
      IntConst  -> Exp {cons("Int")}

      Exp "+"  Exp -> Exp  {left, cons("Plus")}

    lexical syntax
      [\ \t\n]  -> LAYOUT
      [0-9]+    -> IntConst

module Identifiers
  exports
    sorts Id

    lexical syntax
      [a-zA-Z]+ -> Id

Invocation:

  > gen-renamed-sdf-module -i Exp.def -m Expressions --name Exp-Prefixed --prefix Exp

Result:

module Exp-Prefixed
imports Expressions
          [ IntConst => ExpIntConst
            MyId     => ExpMyId
            Exp      => ExpExp ]