TenDRA Home Page

# TenDRA

Welcome to the TenDRA Home Page. TenDRA is a free, public domain C/C++ compiler and checker technology, developed by the Open Software Systems Group (OSSG) at DERA around its TDF/ANDF compiler intermediate format.

TenDRA® is a registered trademark of the UK Defence Evaluation and Research Agency. It is pronounced as one word, tendra, rather than ten-D-R-A.

## Downloading the TenDRA Software

All the TenDRA software is subject to the following copyright notice. Please read it carefully before downloading the TenDRA software.

> Crown Copyright © 1997, 1998

> This TenDRA® Computer Program is subject to Copyright owned by the United Kingdom Secretary of State for Defence acting through the Defence Evaluation and Research Agency (DERA). It is made available to Recipients with a royalty-free licence for its use, reproduction, transfer to other parties and amendment for any purpose not excluding product development provided that any such use et cetera shall be deemed to be acceptance of the following conditions:
> 1. Recipients shall ensure that this Notice is reproduced upon any copies or amended versions of it;

> 2. Any amended version of it shall be clearly marked to show both the nature of and the organisation responsible for the relevant amendment or amendments;

> 3. Its onward transfer from a recipient to another party shall be deemed to be that party's acceptance of these conditions;

> 4. DERA gives no warranty or assurance as to its quality or suitability for any purpose and DERA accepts no liability whatsoever in relation to any use to which it may be put.

A small number of components are also subject to other companies' copyright conditions, which are similar in intent to the DERA notice above. The Power installer was written under license for the Open Software Foundation (based on the existing DERA SPARC installer). The Motif 1.2 API description was written by SCO UK (based on an earlier DERA Motif 1.1 description).

The source for the TenDRA 4.1.2 release can be downloaded from:

> ftp://alph.dera.gov.uk/pub/TenDRA/TenDRA-4.1.2.tar.gz (3888989 bytes).

In addition the release documentation (consisting of a copy of the web pages accessible from this site) can be downloaded from:

> ftp://alph.dera.gov.uk/pub/TenDRA/TenDRA-4.1.2-doc.tar.gz (765752 bytes).

## Installing the TenDRA Software

The main source archive, `TenDRA-4.1.2.tar.gz`, can be extracted using:

    	gzip -d TenDRA-4.1.2.tar.gz
    	tar xvf TenDRA-4.1.2.tar

to give a directory, `TenDRA-4.1.2`, containing the release source. If you also want to install the release documentation you will also need to download `TenDRA-4.1.2-doc.tar.gz` and extract this as above. The documentation is extracted into the subdirectory `TenDRA-4.1.2/doc`.

The release is installed by running the shell script `INSTALL` found in the main source directory. The default configuration installs the public executables into `/usr/local/bin`, the private executables, libraries, configuration files etc. into `/usr/local/lib/TenDRA`, and the manual pages into `/usr/local/man`. It also assumes that the source has been installed in `/usr/local/src/TenDRA-4.1.2`. These locations may be changed by editing the `INSTALL` script (which is fully commented).

Other installation details, such as which compiler to use, can be specified using command-line options to `INSTALL`, or by editing the script. For example:

    	INSTALL -gcc

will install the release using gcc as the compiler. After this the work directory can be removed, and:

    	INSTALL -tcc

run to bootstrap the system.

See the `README` in the top directory of the source code for more details. Also see the Frequently Asked Questions.

## Supported Platforms

The following table gives the list of platforms on which the current release has been compiled and tested:

Operating System | Version | CPU
AIX | 3.2 | Power
HP-UX | A.09.05 | HP-PA
Irix | 5.2 | Mips
Linux | 1.2.8 and 2.0.27 | Intel
OSF1 | V3.2 | Alpha
SCO | 4.2 | Intel
Solaris | 2.3 and 2.4 | SPARC
Solaris | 2.4 | Intel
SunOS | 4.1 | 680x0
SunOS | 4.1.4 | SPARC
Ultrix | 4.4 | Mips
Unixware | 1.1.2 | Intel

It should compile on other versions of these operating system/processor pairs, the only danger area being TDF API library building.

For comments on the reliability of the software on these various platforms, see the section on TDF installers below.

## About the TenDRA Documentation

A number of documents on the TenDRA compiler technology are accessible from this page. These consist of documents written and added to by different people at different times during the technology's development. The information may therefore not be totally up-to-date, be presented from a unified viewpoint, or reflect the current thinking of members of OSSG on the given subjects. Time has not been available for the necessary thorough review of the documentation as a whole.

Most of the documents were originally written in FrameMaker, and converted to HTML using a very old version of WebMaker, numerous sed and perl scripts, and some specially knocked up C programs.

The various documents are described below but here, for reference, is a complete list:

1. TDF Issue 4.0 specification;
2. TDF Diagnostic Extension Issue 3.0;
3. TDF token register;
4. Guide to the TDF specification;
5. TDF and portability;
6. tcc Users' Guide;
7. C Checker Reference Manual;
8. C++ producer guide;
9. pl users' guide;
10. tspec users' guide;
11. tld users' guide;
12. tnc users' guide;
13. calculus users' guide;
14. sid users' guide.

## What is TDF?

TDF (standing for TenDRA Distribution Format) is the compiler intermediate language, which lies at the heart of the TenDRA technology. Unlike most intermediate languages, which tend to be abstractions of assembler languages, TDF is an abstraction of high level languages. The current release is based on TDF Issue 4.0, with experimental extensions to handle debugging in languages such as C++ and Ada (these extensions are not used by default).

The TDF Issue 4.0 specification gives a technical description of the TDF language. This is supplemented by the TDF Diagnostic Extension Issue 3.0 specification. This is an extension to the core TDF specification, which describes how information sufficient to allow for the debugging of C programs can be embedded into a TDF capsule (it is this that the experimental extensions mentioned above are intended to replace).

The companion document, the TDF token register, describes the globally reserved, `standard tokens'.

The Guide to the TDF specification gives an overview and commentary on the TDF language, explaining some of the more difficult concepts.

For those who know a bit of history, TDF was the technology adopted by OSF as their ANDF (Architecture Neutral Distribution Format), and TDF Issue 4.0 (Revision 1) is the base document for The Open Group XANDF standard. Thus the terms TDF, ANDF and XANDF are largely synonymous; TDF is used in documentation since it is the term closest to our hearts.

## What is TenDRA?

TenDRA is the name of the compiler technology built around the TDF intermediate language. The design and intended uses of TDF have affected how the TenDRA technology has developed. For example, the original emphasis of OSF's ANDF concept was on distribution, but this begged the question about program portablility. The current TenDRA technology is far more about portability than it is about distribution, although TDF could still be used as a distribution format.

The rigid enforcement of an interface level between the compiler front-ends and the compiler back-ends, and the goal of producing target independent TDF (suitable for distribution) have produced a flexible, clean compiler technology. It has pulled many of the questions about program portability into sharp focus in a way that a more conventional compiler could not.

## Using the TenDRA Compiler

The main user interface to the TenDRA compiler, tcc, can be used as a direct replacement for the system compiler, cc. This is described in the tcc Users' Guide.

There is an alternative user interface, tchk, which just applies the static program checks and disables code generation. Thus tchk corresponds to lint in the same way that tcc corresponds to cc.

The chief difference between tcc and other compilers is it the degree of preciseness it requires in specifying the compilation environment. This environment consists of two, largely orthogonal, components: the language checks to be applied, and the API to be checked against. For example, the -Xc option specifies ISO C with no extensions and no extra checks, the -Xa option specifies ISO C with common extensions, and -Xs specifies ISO C with no extensions and lots of extra checks. Similarly -Yansi specifies the ISO C API (excluding Amendment 1), -Yposix specifies the POSIX 1003.1 API etc. It is also possible to make tcc use the system headers on the host machine by the use of the -Ysystem option. The -Yc++ option is required to enable the C++ facilities. The default mode is equivalent to -Xc -Yansi.

How to configure the C compiler checks is described in more detail in the C Checker Reference Manual. The extra checks available in C++ are described in the C++ producer guide.

## TDF Producers

A tool which compiles a high-level language to TDF, is called a producer. The TenDRA software contains producers for the C and C++ languages. The original TenDRA C producer (tdfc) has now been superseded by a new C producer (tdfc2) based on the C++ producer (tcpplus).

The design of both producers has been guided by the goal of trying to ensure program portability by means of static program analysis. Some thoughts on this subject are set out in the document TDF and portability.

The first component of this is by ensuring that the language implemented by the producer accurately reflects the corresponding language standard (ISO C, including Amendment 1, or the draft ISO C++ standard). The producers both include references to the standards documents within their error messages, so that a specific error can be tied to a specific clause within the standard. The producers have been tested using both the Plum Hall and Perennial C and C++ compiler validation suites.

The C++ producer implements most of the language sections of the November 1997 draft ISO C++ standard. The known problem areas are:

- Automatic inter-module instantiation of templates is not yet fully implemented.

- The current implementation of exception handling is not optimal with respect to performance.

- Temporaries are not always destroyed in precisely the right place.

- Partially constructed objects are not destroyed properly.

- The visibility of friend functions is not right.

Also, only the language portions and the language-support library (<new>, <typeinfo> and <exception>) have been implemented. If a complete implementation of the standard C++ library is required, it must be obtained from elsewhere. See the C++ producer guide for more details.

## TDF Installers

A tool which compiles TDF to a machine language, is called an installer. TDF installers for a number of Unix systems and processors are included within the release (see the list of supported platforms above). Each installer consists of code from three levels:

1. Code which is common to all installers. A large portion of each installer is derived from a common section, which reads the input TDF capsule and applies various TDF -> TDF transformations to optimise the code. Each installer has a configuration file which indicates which of these transformations are appropriate to its particular processor.

2. Code which is specific to a particular processor. Each installer also has some processor-specific code, which applies optimisations and other transformations, which are too tied to a particular processor to warrant inclusion in the common section. This section also includes register allocation.

3. Code which is specific to a particular processor/operating system pair. Even within the installers for a single processor, there may be differences between different operating systems. These differences are usually cosmetic, such as the precise assembler format etc.

The various installers within the release are of differing levels of reliability and performance tuning, due to the differing priorities in building up an installer base. The Intel and SPARC installers are the most reliable and have been subject to the most performance tuning.

All the installers fully support the C subset of TDF (i.e. code generated by the C producer). The Mips/Ultrix installer does not support the initial_value construct (used in dynamic initialisation), but otherwise all the installers fully support the C++ subset. The Intel and SPARC installers fully support the entire TDF specification, as checked by the OSF AVS (ANDF Validation Suite).

## TDF Interface Tools

The API checking facilities of the TenDRA compiler are implemented by means of abstract interface specifications generated using the tspec tool. This tool and specifications for a number of common APIs are included with the release. Part of the installation process consists of pre-compiling the implementations of those APIs implemented on the target machine into TDF libraries. This is performed automatically using tcc to combine the tspec specification with the implementation given in the system headers.

## Other TDF Tools

There are various tools included within the software for viewing, generating and transforming TDF. The use of these components is integrated into the user interface, tcc, but they may also be called directly.

tld is the TDF linker. It combines a number of TDF capsules into a single capsule. It also can be used to create and manipulate libraries of TDF capsules.

disp

is the TDF pretty printer. It translates the bitstream comprising a TDF capsule into a human readable form.

tnc is the TDF notation compiler. It acts as a sort of TDF `assembler', and can translate TDF capsules to and from a human readable form.

pl is the PL_TDF compiler. It is a TDF `structured assembler' in the lineage of PL360. pl provides a more user-friendly way of generating TDF capsules from scratch than that offered by tnc.

## Compiler Writing Tools

A number of compiler writing tools, which were used in the development of the TenDRA compiler technology are also bundled with the TenDRA software release. These include the following:

sid is an LL(1) parser generator with a long history (the original version dates back to the mid-sixties!). As well as the normal rule transformations it provides powerful techniques for call-outs in circumstances where a non-trivial look-ahead is required (essential for languages like C++), and for error recovery.

calculus is a tool for managing complex C type systems. It uses the TenDRA interface checking techniques to enforce strong type checking and type encapsulation, and provides generic container types for lists, vectors etc.

make_tdf is a tool for generating TDF decoders and encoders. It takes a compact description of the TDF specification and a template file, and generates code to read, write or transform a TDF capsule.

## Related Sites

- Open Group Research Institute ANDF projects.

- DDC-I Ada to ANDF compiler.

Part of the TenDRA Web.
Crown Copyright © 1998.