pp-aterm — pretty-prints an ATerm in text format to make it readable for humans.
[-u | --unescaped]
[-S | --silent]
level | -k
[-h | -? | --help]
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.
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.
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).
Prints strings without escapes.
Common Input/Output Options
The input term given by the file name
In the absence of the
-i option, input
will be read from
The output will be written to the file given by the file name
In the absence of the
output will be written to
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
Display usage information.
Keep intermediate results produced by the internal stages in the
pretty-printing process. This is only useful for debugging. A high
int indicates increased eagerness
for keeping intermediate results.
Default setting is 0, indicating that no intermediates will be kept.
Silent execution. Same as
Set verbosity level to numerical value
higher the number, the more information about pp-aterm's inner workings are
int can be set to either of the
following verbosity levels, given in increasing order of verbosity:
Displays the tool name and version.
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")])])])
$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-depth you can control the number of terms you
want per line and the level of "detail" you want to see, respectively.
Please report bugs to
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.