Name

ast2text — pretty-prints an abstract syntax tree to plain text

Synopsis

ast2text [-w width | --width width] [-p file] [-i file | --input file] [-o file | --input file] [-b] [-S | --silent] [--verbose level] [-k level | --keep level] [-h | -? | --help] [--about] [--version]

Description

The ast2text utility is used to pretty-print abstract syntax trees to plain text. The utility transforms an abstract syntax tree according to formatting rules contained in pretty-print tables. The result of ast2text is an ASCII text file. The tool is a convenience composition of ast2abox and abox2text.

Example

To pretty-print an abstract syntax tree stored in the file tree.trm to text according to the pretty-print rules in rules.pp issue the following command:

$ ast2text -i tree.trm -p rules.pp

Options

Parsing and Formatting Options

-p file

Use pretty-print rules defined in file. Multiple tables can be specified.

The file must have the extension .pp or .pp.af. The .pp extension is used for pretty-print tables in concrete syntax. The .pp.af extension is used for pretty-print tables that have already been parsed using parse-pp-table. Using parsed pretty-print tables improves the performance of ast2abox.

-w width, --width width

Specifies maximal line width. Default is 80 characters.

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.

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.