#term #aterm #annotation

aterm

Implementation of the Annotated Terms data structure

24 releases (15 breaking)

0.20.0 Sep 3, 2017
0.19.0 Aug 30, 2017
0.17.0 Jul 31, 2017

#15 in #term

Download history 31/week @ 2019-08-09 150/week @ 2019-08-23 92/week @ 2019-08-30 31/week @ 2019-09-06 45/week @ 2019-09-13 285/week @ 2019-09-20 30/week @ 2019-09-27 31/week @ 2019-10-04 122/week @ 2019-10-18 144/week @ 2019-10-25 91/week @ 2019-11-01 1/week @ 2019-11-08 61/week @ 2019-11-15

149 downloads per month

MIT/Apache

165KB
1.5K SLoC

This repository holds an implementation of the Annotated Term (ATerm) format in Rust.

Annotated Terms

I suspect that originally ATerms were a big thing because of the convenience of a garbage collected C implementation of arbitrary trees, with maximal sharing. Now it seems to be more of a legacy format. You can still find the old ATerm guide online but I'll briefly recap the format.

Format recap

This format encodes trees. The leaves of the trees can be:

  • Integers (i32)
  • Longs (i64, optional in the spec)
  • Strings (String[^*])
  • Reals (f32)
  • Blobs (Vec<u8>, though when you need this, are ATerms really what you need?)
  • Placeholders (TermPlaceholder, typed holes, for the legacy pattern interface)

The trees are built up with applications of constructors. A constructor is just an alphanumeric name or a quoted string. The application of the constructor has zero or more children.

There are also specialised lists, mostly because they have their own syntax.

Tuples are applications of the empty constructor.

[^*]: actually they're just quoted constructors with zero children

Oh right, and they're annotated: every term can have a list of annotations, which are also terms. Lists and constructor applications are also counted as terms, so basically everything can have annotations.

Features

The Rust implementation has the follow features / todos:

  • Longs
  • Reading/writing ASCII (textual aterms)
  • Utility functions? (Some todos: #7)
  • Maximal sharing (Some todos: #3)
  • Reading/writing TAF #4
  • Reading/writing BAF #5
  • Reading/writing SAF #6

Dependencies

~2.5MB
~62K SLoC