Java Reference
In-Depth Information
Architecture and planning
The problem under consideration involves extracting information from the
source code and reporting it in a formatted way. Adopting the compiler
architecture described above, this processing should be performed on the
intermediate representation.
Since the result of the documentation is HTML we decide to use a
structural representation of HTML as an intermediate representation. The
intermediate representation can easily be serialized and converted into an
HTML document.
A more general and reusable solution would use the Extensible Markup
Language (XML) as intermediate representation language, but this is beyond
the scope of this chapter.
Adopting the architectural style described above we can define the
architecture depicted in Figure 8.5. It is made up of three components that
are responsible for:
run time dynamic generation of HTML documents;
parsing and formatting of Java code;
interaction with the user through a graphical driver interface.
We can see that the HTML DOM component is used by both the language
front end and the graphical driver: the former uses it while assembling an in-
memory representation of the documentation, the latter uses its serialization
capability to generate the documentation. In addition the graphical driver
uses the language front end when analysis of source code is needed.
Accordingly we will split the development of the application into three
phases, each of which builds upon the previous one.
Prototype 1: Intermediate representation . During the first phase of
development we will build a component that supports an intermediate
representation of HTML and its serialization to produce readable HTML
code. This will be a fairly generic and reusable component.
front end
Figure 8.5 Architecture of the application
Search WWH ::

Custom Search