Name

tnc — TDF notation compiler

Synopsis

tnc 

[ -r | -d ] [ -w | -g | -e ]
[ -a ] [ -c ] [ -f ] [ -I dir ] [ -l ] [ -L prefix ] [ -n name ] [ -o output-file ] [ -q ] [ -t ] [ -u ] [ -V ] [ -x ]
[ input-file [ output-file ]  ]

tnc 

-p 
[ -a ] [ -c ] [ -f ] [ -I dir ] [ -l ] [ -L prefix ] [ -n name ] [ -o output-file ] [ -q ] [ -t ] [ -u ] [ -V ] [ -x ]
[ input-file [ output-file ]  ]

tnc 

{ -V | -H subject … }

Description

tnc translates TDF capsules to and from text. It has two input modes, read and decode. In the first, which is default, input-file is a file containing TDF text. In the second input-file is a TDF capsule.

There are also three output modes, decode, write and dot. In the first, which is default, a TDF capsule is written to output-file In the second, TDF text is written to output-file. If the output-file argument is absent, the standard output is used instead. dot is the same, except that the output format is Dot, suitable for processing with Graphviz tools.

Combination of these modes give four actions: text to TDF (which is default), TDF to text, text to text, and TDF to TDF. The last two actions are not precise identities, but they do give equivalent files. These actions are summarised below:

OptionsInput modeOutput modeInput filesOutput files
read (default)decode (default).p.j/.t
-wread (default)write.p.p
-eread (default)dot.p.dot
-ddecodedecode (default).j/.t.p
-dw/-pdecodewrite.j/.t.p
-dgdecodedot.j/.t.dot
-dldecodedecode (default).tl.p
-dwldecodewrite.tl.j/.t

If input-file or output-file are not specified, input and output default to stdin and stdout respectively.

The TDF pretty-printer, disp, provides a more sophisticated TDF to text translator, although its output cannot be used as the input to tnc.

The form of the TDF text format and more information about tnc can be found in the document The TDF Notation Compiler.

Options

-a

Specifies that tnc should expand its input by replacing all applications of defined tokens by the token definition.

-c

Specifies that tnc should apply extra checks to input-file. For example, simple shape checking is applied. These checks are more efficient in read mode than in decode mode.

If the -V option is used in write mode, all the information gleaned from the shape checking appears in output-file.

-d

Specifies that tnc should be in decode mode. That is, that input-file is a TDF capsule.

-g

Specifies that tnc should be in decode mode. That is, that output-file is a TDF capsule. This is the default output mode.

-f

Causes tnc to use its alternative, functional, form for both input and output.

-e

Specifies that tnc should be in dot mode. That is, that output-file is a Dot format graph, suitable for rendering with Graphviz tools.

-H subject …

Makes tnc print its help message on the given subject(s). If no subject is given, or the subject is all, all the help messages are printed.

-I dir

Adds the directory dir to the search path used by tnc to find included files in read mode.

-l

In decode mode, specifies that input-file is not a TDF capsule, but a TDF library. All the capsules comprising the library are decoded.

-L prefix

Causes tnc to treat any external identifiers starting with prefix to be treated as if they were declared local.

-n name

Specify a class of SORT to output; name may be prefixed with an optional “-” meaning to elide output instead. name is one of:

tokdecsaldecstagdecs
tokdefsaldefstagdefs
-o output-file

Gives an alternative method of specifying the output file.

-p

Specifies that tnc should be in decode and write modes. That is, that input-file is a TDF capsule and output-file should consist of TDF text. This option makes tnc into a TDF pretty-printer.

-q

Causes tnc not to check the consistency of multiple tag or token definitions.

-r

Specifies that tnc should be in read mode. That is, that input-file should consist of TDF text. This is the default input mode.

-u

Do not sort tokens when outputting. The default is to sort alphabetically by name.

-t

Specifies that tnc should expand its input by replacing all applications of defined tokens by the token definition and by evaluating constant expressions as far as possible. This is equivalent to -ax.

-V

Makes tnc print its version number and the version of the TDF specification it supports.

-V

In write mode, specifies that the output should be in the "verbose" form, with no shorthand forms.

-w

Specifies that tnc should be in write mode. That is, that output-file should consist of TDF text.

-x

Specifies that tnc should simplify its input by evaluating constant expressions as far as possible.

See Also

disp, tcc.

The TDF Notation Compiler.