The language conversion process is an
iterative process. In general, the code, including the copybooks/includes,
are parsed and put into a metadata format. This information is then
correlated with other modules, making the modifications necessary
for handling the differences between
the two programming languages. Information needed for other modules is
then split out to feed into other source code conversions, creating a
cross pollination effect that ensures that the information needed by a module
is carried through the entire conversion process. The
final code is then generated.
The process begins with the parsing of a single
source and its copy modules into a metadata format. The parsed
information is fed into the language converter along with additional
information that may be pertinent to the conversion, including
data types, prototypes, conversion parameters, and overrides. The
additional information provides the flexibility that is needed to
ensure each conversion covers the client's needs.
For instance, some conversions require the creation
of additional data types if a particular data type is not built into
the target language. If source code is being converted to an object-orientated
language, certain base classes are usually required that
may not have existed in the original code.
Prototypes are another essential component in the conversion process.
Depending on the language, implicit data conversions would be
performed by the compiler, allowing a caller to call a routine with
differing data types for parameters. For languages that do not
support the implicit conversion, explicit conversions need to be
inserted into the code.
Sometimes it is also necessary to implement functionality overrides.
For instance, pathnames to files may need to be modified due to
inconsistencies between operating system platforms.
Lastly, conversion parameters must be fed to the
converter, which will define rules pertinent to the conversion type.
For example, to change all source code that is written in mixed case
to lowercase (excluding quoted strings), a conversion parameter would
be used to do this. Datatek's goal is to make the final result as maintainable as possible to the
end user, according to their coding standards.
Once all of these components have been passed
to the converter, information is extracted out that is required for other
modules, such as variable, parameter, and subroutine usage. From this,
a determination must be made about how variables are used. For
example, a routine that passes a variable must be examined to
determine whether the variable is to be passed by value or reference.
The conversion process then becomes iterative.
With each successive pass through the entire code set,
additional information is generated, since a change to one module
can create the domino effect of requiring modifications in
other modules. Changes to those modules, can then require
modifications to another set of modules, and so on. By having the
ability to quickly and repetitively parse through entire code sets,
making additional modifications on-the-fly, it is clear that
automated language conversions are the most cost effective and
reliable way to convert between programming languages.
|