XES - Project Plan - Class Library Translation phase 2

This proposed enhancement is in the Sourceforge feature request system.

This is a continuation of the class library translation feature here. 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 .net

import java.lang.System;
System.out.println("error: " + e);

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 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.

 

 

 


metadata block
see also:

 

Correspondence about this page

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.