module sdf/tool/xtc
imports
  strategoxt-xtc-tools

strategies      

  xtc-parse-sdf2-module =
    xtc-parse-sdf2(|"Module")

  xtc-parse-sdf2-definition =
    xtc-parse-sdf2(|"SDF")

strategies

  xtc-parse-sdf2 =
      xtc-sglri(|"Sdf2.baf")
    ; xtc-transform(!"sdf-desugar", pass-verbose)

  xtc-parse-sdf2(|sort) =
      xtc-sglri(|"Sdf2.baf", sort)
    ; xtc-transform(!"sdf-desugar", pass-verbose)

strategies    
    
  xtc-pp-sdf2 =
      xtc-transform(!"sdf-ensugar", pass-verbose)
    ; xtc-transform(!"core-sdf-parenthesize", pass-verbose)
    ; xtc-ast2abox(!["Sdf2.pp.af"])
    ; xtc-abox2text

strategies

  /**
   * Normalizes an SDF syntax definition to a grammar.
   *
   * Result is in desugared abstract syntax.
   */
  xtc-sdf2-normalize(|main) =
      xtc-transform(!"sdf2table", !["-n", "-m", main | <pass-v-verbose>])
    ; xtc-transform(!"implodePT", pass-v-verbose)
    ; xtc-transform(!"sdf-desugar", pass-verbose)
