Published October 22, 2023 | Version 1.1
Software Open

Unity: multi-syntax unit parsing

  • 1. University of Glasgow


This is the Unity library, which is able to parse scientific unit specifications using a variety of syntaxes.

The library was written with the following goals:

  • Producing formal grammars of the existing and proposed standard unit syntaxes, for reference purposes.
  • Participating in the VOUnit standardisation process by acting as a locus for experimentation with syntaxes and proposed standards.
  • To that end, discovering edge cases and producing test cases.
  • Producing parsing libraries which are fast and standalone, and so could be conveniently used by other software; this will act as an implementation of the eventual VOUnits standard.  The distribution is buildable using no extra software beyond a Java and a C compiler.  It is also a goal that the distributed Java is source-compatible with Java 1.8 (though this isn't automatically tested, so bugreports are welcome).

It is not a goal for this library to do any processing of the resulting units, such as unit conversion or arithmetic.  Parsing unit strings isn't a deep or particularly interesting problem, but it's more fiddly than one might expect, and so it's useful for it to be done properly once.

A major goal of the VOUnits process is to identify a syntax for unit strings (called 'VOUnits') which is as nearly as possible in the intersection of the various existing standards.  The intention is that if file creators target the VOUnits syntax, the resulting string has a chance of being readable by as many other parsers as possible.  This isn't completely possible (the OGIP syntax doesn't allow dots as multipliers), but we can get close.

This release is v1.1, and matches v1.1 of the VOUnits specification. For release notes, see below, and in the release-notes file in the distribution.

The contents of this upload are

  • : the repository code, as found at tag `1.1` of the repository (note, this is the code repository at release time, when this upload was made; the location of the master repository has changed before and may change again)
  • : the software distribution, as assembled from the repository code after some preprocessing
  • unity-1.1.jar : the executable jar file
  • and : the HTML versions of the documentation for the C and Java versions of the library

Changes in this version:

  • Build bugfix: the build from a repository now works with GNU Make 3, as well as v4.
  • Change the repository location (from sourcehut to heptapod).
  • Updates to a couple of other URIs.
  • VOUnits function-application can now include a 'scalefactor', thus `log(1e3MHz)` (issue #11, in part).
  • Recognise the four additional SI prefixes of 27th CGPM, resolution 3 (ie, ronto, ronno, quecto and quetta) (issue #13).
  • Recognise `%` as a unit (indicating multiplication by 0.01) in the VOUnits syntax (issue #11, in part).
  • Adjust parsing of leading floats: these now parse correctly with large positive positive or negative exponents (issue #12)
  • The `unity.jar` file is now installed to `@prefix@/data/java` (issue #16)
  • Fix status of Besselian/tropical years in FITS.
  • We now require, and claim compatibility with, Java 8.
  • Various build, configuration and documentation tweaks, avoiding warnings. Builds tested on a slightly broader range of platforms (including Alma 9 and Debian 12).



Files (2.2 MB)

Name Size Download all
338.8 kB Preview Download
119.8 kB Preview Download
762.6 kB Preview Download
844.3 kB Preview Download
124.9 kB Download

Additional details

Related works

Technical note: 10.5479/ADS/bib/2014ivoa.spec.0523D (DOI)
Is derived from
Software: (URL)


EUROVO-ICE – Euro-VO International Cooperation Empowerment 261541
European Commission