SDF2PARENTHESIZE(1)

NAME
sdf2parenthesize - generates a Stratego module that puts parenthetical constructors at the correct places.

SYNOPSIS

sdf2parenthesize [-m mod | --main mod] [--omod module] [--main-strategy strategy] [--sig-module module] [--lang lang] [--rule-prefix string] [-i file | --input file] [-o file | --input file] [-b] [-S | --silent] [--verbose level] [-k level | --keep level] [--check] [-h | -? | --help] [--about] [--version]

DESCRIPTION

The sdf2parenthesize utility is used to generate a Stratego transformation tool that adds the necessary parentheses to an abstract syntax tree. The information is obtained from an SDF syntax definition.

The following SDF situations are supported by sdf2parenthesize:

1.  Relative priorities

    Exp "&&"  Exp -> Exp
    > Exp "||"  Exp -> Exp

2.  Groups of associative productions

    {left:
      Exp "*" Exp -> Exp
      Exp "/" Exp -> Exp
    }
    > {left:
      Exp "+" Exp -> Exp
      Exp "-" Exp -> Exp
      }

3.  Associativity attributes: non-assoc, assoc, left, right.

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

4.  Kernel SDF associativities

    prod1 assoc prod2

OPTIONS

Generator Options

-m mod, --main mod
    Set the main module in the SDF syntax definition to mod. The default main module is Main.

--omod mod
    Set the name of the resulting Stratego module. The default is to use the filename (basename, i.e. without file type suffix) of the output file.

--main-strategy strategy
    Set the name of the main strategy for the generated tool. The default is to use io-module, where module is the module name.

--sig-module module
    Specify the Stratego module which contains the signature for the language. The default is to use language, see the --lang option.

--lang language
    Name of the language. The default is to use the basename of the output file.

--rule-prefix string
    Prefix to use for the generated parenthesize rules. The default is to use language, see the --lang option.

Common Input/Output Options

-i file
    The input term given by the file name file.

    In the absence of the -i option, input will be read from stdin.

-o file
    The output will be written to the file given by the file name file.

    In the absence of the -o option, output will be written to stdout.

-b  The output will be written in the binary (BAF) ATerm format.

    ATerms in the BAF format require a lot less space than ones in the TAF format, but the Java ATerm library does not currently support baf ATerms. ATerms in the baf format is the preferred format of exchange between Stratego tools.

Common Debugging Options

--about
    See --version.

-h, -?, --help
    Display usage information.

--keep int
    Keep intermediate results produced by the internal stages in the pretty-printing process. This is only useful for debugging. A high value of int indicates increased eagerness for keeping intermediate results.

    Default setting is 0, indicating that no intermediates will be kept.

-S, --silent
    Silent execution. Same as --verbose 0.

--verbose int
    Set verbosity level to numerical value int. The higher the number, the more information about pp-aterm's inner workings are printed.

    Alternatively, int can be set to either of the following verbosity levels, given in increasing order of verbosity: emergency, alert, critical, error, warning, notice, info, debug, vomit.

--version
    Displays the tool name and version.

EXAMPLE

Assume Plus is declared as left associative. In this case, sdf2parenthesize will create the following rule:

ExpParenthesize :
  Plus(q_15, Plus(o_15, p_15)) -> Plus(q_15, Parenthetical(Plus(o_15, p_15)))

The following shows how sdf2parenthesize deals with relative priorities.

ExpParenthesize :
  Mul(Plus(v_2, w_2), u_2) -> Mul(Parenthetical(Plus(v_2, w_2)), u_2)
ExpParenthesize :
  Mul(t_2, Plus(v_2, w_2)) -> Mul(t_2, Parenthetical(Plus(v_2, w_2)))

REPORTING BUGS

Please report bugs to <stratego-bugs@cs.uu.nl>

COPYRIGHT

Copyright (C) 2002-2005 Eelco Visser <visser@acm.org>

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.