Further information is availible about this proposed
enhancement here:
http://www.euclideanspace.com/software/language/xes/project/library2/
This is a continuation of the class library translation
feature here:
http://www.euclideanspace.com/software/language/xes/project/library/
The first version provided for a simple substitution
of one symbol table entry for another but we really
need a more complex translation, In the following example:
Java snippet:
import java.lang.System;
System.out.println("error: " + e);
.net snippet:
using System;
Console.WriteLine("error: " + e);
We want to:
1) Translate the import 'java.lang.System' to the
equivalent in the destination language for example
'System'.
2) The translation must be able to handle wildcards,
for instance 'import java.lang.*;'
3) Then we want to translate any external method calls
and parameters. In this case we want to translate
'System.out.println' to 'Console.WriteLine'.
4) If there is no import 'java.lang.System' but instead
we have a system defined locally then we want leave the
class name as it is.
5) If the text 'java.lang.System' appears in a comment
or a string constant then we want leave the string as
it is.
Note: the syntax and keywords (such as 'import' to
'using') are translated by parser when reading or XSLT
when exporting so do not need to translated by this method.
To implement this we need to go though this sequence:
1) Translate the package/method names in the import
statements to Java package/method names.
2) Load the external references described here:
http://www.euclideanspace.com/software/language/xes/project/external/
with information about other classes in the current
packages and packages/classes referenced in import
statements.
3) All references to classes, methods and parameters
must be matched to their definitions which might be in
the local file structure or in the external references.
When the definition is found it is recorded in the node
that uses it as an XPath string.
4) Where the definition is an external import it is
translated into the equivalent Java name.