ASIS 2 XML

This program converts a unit's ASIS representation into XML, so as to make it easier to develop transformational tools using (for example) XSLT.

It's in the gnat-asis archive at tools/asis2xml and can be downloaded here.

As supplied, it relies on GNAT to a limited extent, though it hasn't been tested against other ASIS implementations. The GNAT feature it uses is that Data_Decomposition.Size has been extended to work for Subtype Indications; the purpose is to work out how many bytes a record component will occupy when streamed. This was the original motivation for the work.

Not every ASIS feature is supported yet, and in particular

  • what you get corresponds to a straightforward navigation through the tree, there's no cross-linking.
  • there's no attempt to relate the structure to the source text.
  • Comments aren't preserved.

There is no explicit XML Schema as yet, though this will obviously be an important part of the work. The output's structure is quite close to that of ASIS, at least in overall terms; for example, an A_Defining_Name element in ASIS is represented as a <defining_name/> element in XML. This is hardly surprising since the default strategy, faced with an ASIS Element, is to translate it to an XML element with the indicated substitution!

Another program in the same space is Avatox from McKae Technologies.


Ada programming, © 2005,2006 the Authors, Content is available under GNU Free Documentation License.