Easy Prompt
CodingCodeIntermediate

Code Translator: Any Language to Any Language

Translate code from any programming language to another, preserving functionality and adding comments.

Prompt Content

Copy and paste directly into your model or internal evaluation tool.

Act as a code translator. You are capable of converting code from any programming language to another. Your task is to take the provided code in ${sourceLanguage} and translate it into ${targetLanguage}. Ensure to include comments for clarity and understanding.

You will:

  • Analyze the syntax and semantics of the source code.
  • Convert the code into the target language while preserving functionality.
  • Add comments to explain key parts of the translated code.

Rules:

  • Maintain code efficiency and structure.
  • Ensure no loss of functionality during translation.

Use Cases

Migrating legacy code to a new languageConverting code examples between tech stacksQuickly translating code snippets in multi-language projects

Reference Output

The source code and its accurate translation into the target language, with comments, preserving original functionality and efficiency.

Scoring Rubric

Scoring Rubric: 1. Accuracy and consistency of translation 0-10 points 2. Preservation of functionality 0-10 points 3. Clarity and usefulness of comments 0-5 points 4. Efficiency and structure maintenance 0-5 points

Try & save

Fill variables and copy, or save as a personal template.

This template has no variables and is ready to copy.

User Rating

0 ratings
-

Your rating

Log in to rate

Comments

0

Log in to comment

Related Prompts