ATerm Format

XT -- A Bundle of Program Transformation Tools

Introduction

The ATerm (Annotated Term) Format is a format for exchanging structured data between tools. The ATerm format is a generic internal and external representation of data by means of simple prefix terms.

Abstract Data Type

An ATerm is an expression according to the following grammar:

  t  := bt                 -- basic term
       | bt { t }          -- annotated term

  bt := C                  -- constant
       | C(t1,...,tn)      -- n-ary constructor
       | (t1,...,tn)       -- n-ary tuple
       | [t1,...,tn]       -- list
       | "ccc"             -- quoted string
       | int               -- integer
       | real              -- floating point number
       | blob              -- binary large object
Here C is a constructor name, which is either an identifier or a quoted string.

Format

ATerms can be exchanged in several formats:

  • The Binary ATerm Format (BAF) is an efficient format that preserves maximal sharing.
  • The Textual ATerm Format (TAF) preserves maximal sharing but is not as efficient as BAF.
  • The plain text format (TEXT) is a textual format that does not preserve maximal sharing.

The baffle tool in the ATerm Library can be used to convert the formats.

Library

The ATerm Format is supported by ATerm Libraries for C, Java, and Haskell.

Application

The ASF+SDF Meta Environment operates on AsFix representations of source code in the ATerm format.

The Stratego program transformation language uses ATerms to represent abstract syntax trees:

  • Specification defines transformation of ATerms
  • ATerm library is used in implementation of terms
  • Exchange of syntax trees as ATerms

Publications

The ATerm format is described in the following publication:

  • M. G. J. van den Brand, H. A. de Jong, P. Klint, and P. A. Olivier. Efficient Annotated Terms. Software - Practice \& Experience, 30:259-291, 2000.