Name

pp-aterm — pretty-prints an ATerm in text format to make it readable for humans.

Synopsis

pp-aterm [-i file] [--max-term-size int] [--max-depth int] [-u | --unescaped] [-o file] [-b] [-S | --silent] [--verbose level] [--keep level | -k level] [-h | -? | --help] [--about] [--version]

Description

The pp-aterm utility is primarily used for inspecting an ATerm. It prints an ATerm as text and adds layout to make the structure more clear. Some aspects of the formatting may be controlled by command line switches.

pp-aterm may also be used to convert between the binary (BAF) and textual (TAF) ATerm formats. This is useful for interoperability with the Java ATerm library, which does not currently support ATerms in the BAF format.

Options

Formatting Options

--max-depth int

The depth, i.e. nested level of subterms pp-aterm will traverse before a generic subterm marker will be printed. By default, there is no restriction to the depth.

Note that if you use this option, you cannot feed the resulting output to other tools.

--max-term-size int

The maximal number of terms allowed per line. The higher the number, the more columns are required for the result.

Default is 8. Minimum is 1 (0 will be adjusted to 1).

-u, --unescaped

Prints strings without escapes.

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

The following is a typical term stored in a textual ATerm (taf) file:

Let([FunDecs([FunDec("fact",[FArg("n",Tp(Tid("int")))],Tp(Tid("int")),
If(Lt(Var("n"),Int("1")),Int("1"),Seq([Times(Var("n"),Call(
Var("fact"),[Minus(Var("n"),Int("1"))]))])))])],[Call(
Var("printint"),[Call(Var("fact"),[Int("10")])])])
    

By running

$ pp-aterm -i prot.trm

, we get the readable version below:

Let(
  [ FunDecs(
      [ FunDec(
          "fact"
        , [FArg("n", Tp(Tid("int")))]
        , Tp(Tid("int"))
        , If(
            Lt(Var("n"), Int("1"))
          , Int("1")
          , Seq(
              [ Times(
                  Var("n")
                , Call(
                    Var("fact")
                  , [Minus(Var("n"), Int("1"))]
                  )
                )
              ]
            )
          )
        )
      ]
    )
  ]
, [ Call(
      Var("printint")
    , [Call(Var("fact"), [Int("10")])]
    )
  ]
)
    

By using the options --max-term-size and --max-depth you can control the number of terms you want per line and the level of "detail" you want to see, respectively.

Reporting Bugs

Please report bugs to

Copyright

Copyright (C) 2002-2005 Eelco Visser

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.