Efficient annotated terms

Mark G. J. van den Brand, H. A. de Jong, Paul Klint, Pieter A. Olivier. Efficient annotated terms. Software: Practice and Experience, 30(3):259-291, 2000. [doi]

Abstract

How do distributed applications exchange (tree-like) data structures? To this end, we introduce the abstract data type of Annotated Terms (ATerms) and discuss their design, implementation and application. A comprehensive procedural interface enables creation and manipulation of ATerms in C. A Java version is also supported. The ATerm implementation is based on maximal subterm sharing and automatic garbage collection. A binary exchange format for the concise representation of ATerms (sharing preserved) allows the fast exchange of ATerms between applications. In a typical application—parse trees which contain quite some redundant information—less than 2 bytes are needed to represent a node in memory, and less than 2 bits are needed to represent it in binary format. It is shown that the implementation of ATerms scales up to the manipulation of ATerms in the giga-byte range.