Figure 8.2 Use case of the application
When analysing the specification, two main issues arise concerning the
input language: first we have to parse source code written in a high-level
programming language (Java in the example), second the application should
be easily adaptable to new languages. The parsing of a programming lan-
guage is usually a non-trivial task, but many tools are available that simplify
this task. In addition, from the reference example we can note that a very
simple analysis of the source code is required, Therefore the implemen-
tation of the proof of concept does not require a fully fledged parser. The
adaptability issue must be carefully addressed by the architecture of the
application, since no simplification can be found reading the specification.
The selection of HTML as the format for the documentation has a twofold
advantage: first we have to take into consideration only one output language,
second HTML is based on a hierarchical structure, which helps in assem-
bling several pieces of information in a single document. The example
provides a good overview of the features of HTML that should be used for
generating the documentation.
The application exhibits a set of functionalities that are similar to the ones
provided by the javadoc program, which is part of the Sun JDK, but javadoc
requires the programmer to furnish the code with additional comments.
The approach taken with this application is more general and it is
intended to be more customizable; moreover it is applicable to languages
other than Java.
The system we want to develop is in essence a translator from an input
language (the source code language) to output language (the documentation
language). We can borrow many ideas regarding the architecture of such a
system from the mature toolbox of compilers and formal languages.
The structure of a compiler, or more generally a translator, can be split
into three main components:
a front end, responsible for the lexical and syntactical analysis of the
input language (the programming language);