ApiGen
Description
ApiGen is a tool that generates C or Java code to implement tree-like data-structures.
ATerms are used as internal representation. The generated code is characterized by:
- Maximal subterm sharing
- Strong typing
- Support for (de)serialization
- Support for the Visitor design pattern (Java only)
- Support for pattern matching via JTom
The key design considerations of
ApiGen are:
- To generate type-safe and readable programming interfaces in C and Java
- To be very memory efficient through maximal subterm sharing
- To support ATerm programming at a higher level of abstraction
The above figure illustrates how application code can use ATerms:
- (a) Application code uses hand-written code to manipulate ATerms directly.
- (b) Application code uses hand-written code to manipulate a view on ATerms (in this case AsFix? , the parse tree format used in the Meta-Environment). This code will contain a lot of explicit knowledge how view elements are expressed in the ATerm representation.
- (c) The AsFix? view is defined in an SDF grammar and the access code is generated by ApiGen; the application uses this generated code to manipulate the AsFix? view.
The general observation is that it is much easier to modify views when using access code that has been generated by
ApiGen. Overall maintainability is thus enhanced.
ApiGen is used for the construction of:
- Compilers
- Type-checkers
- Structure editors
- Etc.
The input for
ApiGen is one of the following:
- A data type definition in the ADT format
- A syntax definition in SDF which can be compiled to ADT format in two styles:
- parse tree format (concrete syntax trees)
- ``imploded'' parse tree format (abstract syntax trees)
API documentation
Here
Publications
%BIBTEX{
@article{apigen,
author = {H. A. de Jong and
Pieter A. Olivier},
title = {Generation of abstract programming interfaces from syntax
definitions.},
journal = {J. Log. Algebr. Program.},
volume = {59},
number = {1-2},
year = {2004},
pages = {35-61},
ee = {http://dx.doi.org/10.1016/j.jlap.2003.12.002},
bibsource = {DBLP,
http://dblp.uni-trier.de},
url = "http://www.asfsdf.org/pub/Meta-Environment/ApiGen/jlap.pdf"
}
@article{apigenjava,
author = {Brand, {M.G.J. van den} and Moreau, P.E. and Vinju, J.J.},
title = {A generator of efficient strongly typed abstract syntax trees in Java},
journal = {IEE Proceedings -- Software},
volume = {152},
numbmer = {2},
year = {2005},
month = {April},
pages = {70-78},
url = "http://www.asfsdf.org/pub/Meta-Environment/ApiGen/submitted-20-11-2003.pdf"
}
}%