Easy Prompt
代码能力代码进阶

代码翻译器:任意语言到任意语言

将任意编程语言的代码翻译为另一目标语言,保留功能并添加注释。

提示词正文

复制后可直接粘贴到模型或内部评测工具。

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.

使用场景

将遗留系统代码迁移到新语言在不同技术栈间转换代码示例多语言项目开发中快速转换代码片段

参考输出

源代码及其准确翻译成目标语言的版本,包含注释,保留了原本的功能和效率。

评分维度

评分标准 1. 翻译的准确性和一致性 0-10分 2. 功能保留完好程度 0-10分 3. 注释清晰度和有用性 0-5分 4. 效率和结构保持 0-5分

试用与模板

填写变量后复制,或保存到个人工作台模板。

这个模板没有变量,可直接复制使用。

用户评分

0 个评分
-

你的评分

登录后评分

评论

0

登录后评论

相关提示词