Structured Chain-of-Thought Prompting for Code Generation
On the map: LLM reasoning → Reasoning for agents, planning and code
Abstract (arXiv)
Large Language Models (LLMs) (e.g., ChatGPT) have shown impressive performance in code generation. LLMs take prompts as inputs, and Chain-of-Thought (CoT) prompting is the state-of-the-art prompting technique. CoT prompting asks LLMs first to generate CoTs (i.e., intermediate natural language reasoning steps) and then output the code. However, CoT prompting is designed for natural language generation and has low accuracy in code generation. In this paper, we propose Structured CoTs (SCoTs) and present a novel prompting technique for code generation, named SCoT prompting. Our motivation is source code contains rich structural information and any code can be composed of three program structures (i.e., sequence, branch, and loop structures). Intuitively, structured intermediate reasoning steps make for structured source code. Thus, we ask LLMs to use program structures to build CoTs, obtaining SCoTs. Then, LLMs generate the final code based on SCoTs. Compared to CoT prompting, SCoT prompting explicitly constrains LLMs to think about how to solve requirements from the view of source code and further the performance of LLMs in code generation. We apply SCoT prompting to two LLMs (i.e., ChatGPT and Codex) and evaluate it on three benchmarks (i.e., HumanEval, MBPP, and MBCPP). (1) SCoT prompting outperforms the state-of-the-art baseline - CoT prompting by up to 13.79% in Pass@1. (2) Human evaluation shows human developers prefer programs from SCoT prompting. (3) SCoT prompting is robust to examples and achieves substantial improvements.
Key facts. Cited by 138 papers in the map (data through 14 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 27 of its 53 references that are in the map. First posted on arXiv 11 May 2023.
Builds on
27 of 53 references.
References · 27
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2022Training language models to follow instructions with human feedbackcited by 15,971
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,708
- 2021Finetuned Language Models Are Zero-Shot Learnerscited by 3,780
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2019The Curious Case of Neural Text Degenerationcited by 2,916
- 2022Self-Instruct: Aligning Language Models with Self-Generated Instructionscited by 2,724
- 2018CommonsenseQA: A Question Answering Challenge Targeting Commonsense Knowledgecited by 1,822
- 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,407
15 more
- 2021Calibrate Before Use: Improving Few-Shot Performance of Language Modelscited by 1,392
- 2023WizardLM: Empowering large pre-trained language models to follow complex instructionscited by 1,125
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2023StarCoder: may the source be with you!cited by 799
- 2015Sequence Level Training with Recurrent Neural Networkscited by 576
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
- 2022CodeT: Code Generation with Generated Testscited by 384
- 2022Multi-lingual Evaluation of Code Generation Modelscited by 159
- 2023Self-Edit: Fault-Aware Code Editor for Code Generationcited by 111
- 2023What Makes Good In-context Demonstrations for Code Intelligence Tasks with LLMs?cited by 47
- 2023SkCoder: A Sketch-based Approach for Automatic Code Generationcited by 40
- 2022Fault-Aware Neural Code Rankerscited by 33
- 2022AixBench: A Code Generation Benchmark Datasetcited by 22
- 2022CodeEditor: Learning to Edit Source Code with Pre-trained Modelscited by 12
- 2021Modular Tree Network for Source Code Representation Learningcited by 8
Built on by
Citing papers per year: 2023: 8; 2024: 35; 2025: 60; 2026: 35.
138 papers.
Sort:
By area:
- 2024A Systematic Survey of Prompt Engineering in Large Language Models: Techniques and Applicationscited by 431
- 2025VisuLogic: A Benchmark for Evaluating Visual Reasoning in Multi-modal Large Language Modelscited by 107
- 2024Faithful Logical Reasoning via Symbolic Chain-of-Thoughtcited by 100
- 2024EvoCodeBench: An Evolving Code Generation Benchmark Aligned with Real-World Code Repositoriescited by 72
- 2024DevEval: A Manually-Annotated Code Generation Benchmark Aligned with Real-World Code Repositoriescited by 72
- 2025AgentRxiv: Towards Collaborative Autonomous Researchcited by 72
- 2024Vul-RAG: Enhancing LLM-based Vulnerability Detection via Knowledge-level RAGcited by 68
- 2024Bugs in Large Language Models Generated Code: An Empirical Studycited by 60
- 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
- 2024Exploring and Unleashing the Power of Large Language Models in Automated Code Translationcited by 57
- 2025Large Language Models Hallucination: A Comprehensive Surveycited by 49
- 2024A Survey of Prompt Engineering Methods in Large Language Models for Different NLP Taskscited by 47
38 more
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMscited by 47
- 2023Large Language Model-Aware In-Context Learning for Code Generationcited by 43
- 2023Hot or Cold? Adaptive Temperature Sampling for Code Generation with Large Language Modelscited by 38
- 2023AgentCoder: Multi-Agent-based Code Generation with Iterative Testing and Optimisationcited by 35
- 2024SOEN-101: Code Generation by Emulating Software Process Models Using Large Language Model Agentscited by 34
- 2024EvoCodeBench: An Evolving Code Generation Benchmark with Domain-Specific Evaluationscited by 34
- 2025CodeCoR: An LLM-Based Self-Reflective Multi-Agent Framework for Code Generationcited by 34
- 2024Text-Tuple-Table: Towards Information Integration in Text-to-Table Generation via Global Tuple Extractioncited by 33
- 2025Uncertainty-Guided Chain-of-Thought for Code Generation with LLMscited by 32
- 2024Benchmarking Data Science Agentscited by 30
- 2023CodeCoT: Tackling Code Syntax Errors in CoT Reasoning for Code Generationcited by 29
- 2025AI Agentic Programming: A Survey of Techniques, Challenges, and Opportunitiescited by 28
- 2023Chain-of-Thought in Neural Code Generation: From and For Lightweight Language Modelscited by 27
- 2025Does Context Matter? ContextualJudgeBench for Evaluating LLM-based Judges in Contextual Settingscited by 24
- 2025SEW: Self-Evolving Agentic Workflows for Automated Code Generationcited by 20
- 2023INTERVENOR: Prompting the Coding Ability of Large Language Models with the Interactive Chain of Repaircited by 18
- 2024UniCoder: Scaling Code Large Language Model via Universal Codecited by 18
- 2024Evaluating Software Development Agents: Patch Patterns, Code Quality, and Issue Complexity in Real-World GitHub Scenarioscited by 18
- 2024OMPGPT: A Generative Pre-trained Transformer Model for OpenMPcited by 16
- 2025Could Thinking Multilingually Empower LLM Reasoning?cited by 16
- 2025Give LLMs a Security Course: Securing Retrieval-Augmented Code Generation via Knowledge Injectioncited by 16
- 2025Exploring the Potential of Diffusion Large Language Models in Code Generationcited by 16
- 2024Leveraging Print Debugging to Improve Code Generation in Large Language Modelscited by 15
- 2024Beyond Functional Correctness: Investigating Coding Style Inconsistencies in Large Language Modelscited by 15
- 2025Are Large Language Models Reliable AI Scientists? Assessing Reverse-Engineering of Black-Box Systemscited by 14
- 2024Leveraging Large Language Models for Enhancing the Understandability of Generated Unit Testscited by 11
- 2025Enhancing LLM-based Quantum Code Generation with Multi-Agent Optimization and Quantum Error Correctioncited by 11
- 2025Lang-PINN: From Language to Physics-Informed Neural Networks via a Multi-Agent Frameworkcited by 11
- 2025Exploring Code Language Models for Automated HLS-based Hardware Generation: Benchmark, Infrastructure and Analysiscited by 10
- 2025Rethinking the Evaluation of Secure Code Generationcited by 10
- 2024DevEval: Evaluating Code Generation in Practical Software Projectscited by 9
- 2025Can LLMs Generate Reliable Test Case Generators? A Study on Competition-Level Programming Problemscited by 9
- 2025Automated Knowledge Graph Construction using Large Language Models and Sentence Complexity Modellingcited by 9
- 2024Say More with Less: Understanding Prompt Learning Behaviors through Gist Compressioncited by 8
- 2025ARCS: Agentic Retrieval-Augmented Code Synthesis with Iterative Refinementcited by 7
- 2025RedTeamLLM: an Agentic AI framework for offensive securitycited by 7
- 2025What Makes a Good Natural Language Prompt?cited by 7
- 2023Bridging Code Semantic and LLMs: Semantic Chain-of-Thought Prompting for Code Generationcited by 6
50 most cited of 138 All 138 (JSON)
- 2026Agentic AI with Structured CoT for Enhancing AI's Spatial Intelligence: Visualization and Reasoning of Rotation3 Oct 2026
- 2026SyRHM: Symbolic-Language-Enhanced Reasoning with Associative Retrieval for Zero-shot Harmful Meme Detection12 Sep 2026
- 2026GraphAHA: Graph-Based Adaptive Search with Heterogeneous Actions for Test-Time Code Generation11 Sep 2026
- 2026CIT-CAD: Constraint Intent Tree-based CAD Code Generation and Verification7 Sep 2026
- 2026How Well Can AI Generate Backlogs from App Mockups?24 Jul 2026
- 2026Beyond Detection: Agentic Attack Synthesis and Simulation for Smart Contracts17 Jul 2026
- 2026Large Language Models for Code Generation from Multilingual Prompts: A Curated Benchmark and a Study on Code Quality16 Jul 2026
- 2026Quantize with Confidence? An Empirical Study of Quantization for Code Generation15 Jul 2026
- 2026IntentTester: Intent-Driven Multi-agent Framework for Cross-Library Test Migration24 Jun 2026
- 2026Repository-Level Solidity Code Generation with Large Language Models: From Prompting to Fine-Tuning18 Jun 2026
- 2026Functional Cache Grafting: Robust and Rapid Code-Policy Synthesis for Embodied Agents11 Jun 2026
- 2026SpaceVLN: A Zero-Shot Vision-and-Language Navigation Agent with Online Spatial Cognitive Memory and Reasoning8 Jun 2026
38 more
- 2026Efficient Skill Grounding via Code Refactoring with Small Language Models6 Jun 2026
- 2026Framing Migration News with LLMs: Structured CoT as a Support for Human Interpretation2 Jun 2026
- 2026MAS-Algorithm: A Workflow for Solving Algorithmic Programming Problems with a Multi-Agent System7 May 2026
- 2026TDD Governance for Multi-Agent Code Generation via Prompt Engineering29 Apr 2026
- 2026Learning from Execution: Self-Evolving Memory for Private-Library Code Generation27 Apr 2026
- 2026BODHI: Precise OS Kernel Specification Inference22 Apr 2026
- 2026Text2Model: Modeling Copilots for Text-to-Model Translation14 Apr 2026
- 2026DuET: Dual Execution for Test Output Prediction with Generated Code and Pseudocode13 Apr 2026
- 2026Static Program Slicing Using Language Models With Dataflow-Aware Pretraining and Constrained Decoding9 Apr 2026
- 2026Strengthening Human-Centric Chain-of-Thought Reasoning Integrity in LLMs via a Structured Prompt Framework6 Apr 2026
- 2026InCoder-32B-Thinking: Industrial Code World Model for Thinking3 Apr 2026
- 2026Self-Improving Code Generation via Semantic Entropy and Behavioral Consensus31 Mar 2026
- 2026PR-CAD: Progressive Refinement for Unified Controllable and Faithful Text-to-CAD Generation with Large Language Models27 Mar 2026
- 2026ReCUBE: Evaluating Repository-Level Context Utilization in Code Generation26 Mar 2026
- 2026To See is Not to Master: Teaching LLMs to Use Private Libraries for Code Generation16 Mar 2026
- 2026Design-Specification Tiling for ICL-based CAD Code Generation13 Mar 2026
- 2026AI-for-Science Low-code Platform with Bayesian Adversarial Multi-Agent Framework3 Mar 2026
- 2026VeriInteresting: An Empirical Study of Model Prompt Interactions in Verilog Code Generation4 Feb 2026
- 2026PaperX: A Unified Framework for Multimodal Academic Presentation Generation with Scholar DAG30 Jan 2026
- 2026Latent Chain-of-Thought as Planning: Decoupling Reasoning from Verbalization29 Jan 2026
- 2026Benchmarking Text-to-Python against Text-to-SQL: The Impact of Explicit Logic and Ambiguity22 Jan 2026
- 2026RISE: Rule-Driven SQL Dialect Translation via Query Reduction9 Jan 2026
- 2026Advancing Language Models for Code-related Tasks8 Jan 2026
- 2025BRAID: Bounded Reasoning for Autonomous Inference and Decisions17 Dec 2025
- 2025Parameter Importance-Driven Continual Learning for Foundation Models19 Nov 2025
- 2025FractalBench: Diagnosing Visual-Mathematical Reasoning Through Recursive Program Synthesis9 Nov 2025
- 2025Collaborative Agents for Automated Program Repair in Ruby6 Nov 2025
- 2025Real-Time World Crafting: Generating Structured Game Behaviors from Natural Language with Large Language Models19 Oct 2025
- 2025Does GenAI Rewrite How We Write? An Empirical Study on Two-Million Preprints18 Oct 2025
- 2025Prompt-Guided Spatial Understanding with RGB-D Transformers for Fine-Grained Object Relation Reasoning13 Oct 2025
- 2025Large Language Models Hallucination: A Comprehensive Survey5 Oct 2025
- 2025Lang-PINN: From Language to Physics-Informed Neural Networks via a Multi-Agent Framework3 Oct 2025
- 2025VibeCodeHPC: An Agent-Based Iterative Prompting Auto-Tuner for HPC Code Generation Using LLMs26 Sep 2025
- 2025Reinforcement Learning-Guided Chain-of-Draft for Token-Efficient Code Generation26 Sep 2025
- 2025Reverse Engineering User Stories from Code using Large Language Models23 Sep 2025
- 2025Automated Knowledge Graph Construction using Large Language Models and Sentence Complexity Modelling22 Sep 2025
- 2025Exploring the Potential of Diffusion Large Language Models in Code Generation14 Sep 2025
- 2025Enhancing Factual Accuracy and Citation Generation in LLMs via Multi-Stage Self-Verification6 Sep 2025
50 newest of 138 All 138 (JSON)
- 2025VisuLogic: A Benchmark for Evaluating Visual Reasoning in Multi-modal Large Language Modelscited by 107
- 2024Faithful Logical Reasoning via Symbolic Chain-of-Thoughtcited by 100
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMscited by 47
- 2025Uncertainty-Guided Chain-of-Thought for Code Generation with LLMscited by 32
- 2023CodeCoT: Tackling Code Syntax Errors in CoT Reasoning for Code Generationcited by 29
- 2023Chain-of-Thought in Neural Code Generation: From and For Lightweight Language Modelscited by 27
- 2025Could Thinking Multilingually Empower LLM Reasoning?cited by 16
- 2023Bridging Code Semantic and LLMs: Semantic Chain-of-Thought Prompting for Code Generationcited by 6
- 2024Does Few-Shot Learning Help LLM Performance in Code Synthesis?cited by 6
- 2025Knowledge Augmented Complex Problem Solving with Large Language Models: A Surveycited by 6
- 2026Latent Chain-of-Thought as Planning: Decoupling Reasoning from Verbalizationcited by 6
- 2026InCoder-32B-Thinking: Industrial Code World Model for Thinkingcited by 4
12 most cited of 25 All 25 (JSON)
- 2026Agentic AI with Structured CoT for Enhancing AI's Spatial Intelligence: Visualization and Reasoning of Rotation3 Oct 2026
- 2026GraphAHA: Graph-Based Adaptive Search with Heterogeneous Actions for Test-Time Code Generation11 Sep 2026
- 2026Strengthening Human-Centric Chain-of-Thought Reasoning Integrity in LLMs via a Structured Prompt Framework6 Apr 2026
- 2026InCoder-32B-Thinking: Industrial Code World Model for Thinking3 Apr 2026
- 2026Latent Chain-of-Thought as Planning: Decoupling Reasoning from Verbalization29 Jan 2026
- 2025BRAID: Bounded Reasoning for Autonomous Inference and Decisions17 Dec 2025
- 2025Parameter Importance-Driven Continual Learning for Foundation Models19 Nov 2025
- 2025FractalBench: Diagnosing Visual-Mathematical Reasoning Through Recursive Program Synthesis9 Nov 2025
- 2025Prompt-Guided Spatial Understanding with RGB-D Transformers for Fine-Grained Object Relation Reasoning13 Oct 2025
- 2025Enhancing Factual Accuracy and Citation Generation in LLMs via Multi-Stage Self-Verification6 Sep 2025
- 2025Reasoning as a Resource: Optimizing Fast and Slow Thinking in Code Generation Models11 Jun 2025
- 2025Doc-CoB: Enhancing Document Understanding with Visual Chain-of-Boxes Reasoning24 May 2025
12 newest of 25 All 25 (JSON)
- 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
- 2023AgentCoder: Multi-Agent-based Code Generation with Iterative Testing and Optimisationcited by 35
- 2024SOEN-101: Code Generation by Emulating Software Process Models Using Large Language Model Agentscited by 34
- 2025CodeCoR: An LLM-Based Self-Reflective Multi-Agent Framework for Code Generationcited by 34
- 2024Benchmarking Data Science Agentscited by 30
- 2025AI Agentic Programming: A Survey of Techniques, Challenges, and Opportunitiescited by 28
- 2025SEW: Self-Evolving Agentic Workflows for Automated Code Generationcited by 20
- 2024Evaluating Software Development Agents: Patch Patterns, Code Quality, and Issue Complexity in Real-World GitHub Scenarioscited by 18
- 2025Enhancing LLM-based Quantum Code Generation with Multi-Agent Optimization and Quantum Error Correctioncited by 11
- 2025Lang-PINN: From Language to Physics-Informed Neural Networks via a Multi-Agent Frameworkcited by 11
- 2025RedTeamLLM: an Agentic AI framework for offensive securitycited by 7
- 2025DefenderBench: A Toolkit for Evaluating Language Agents in Cybersecurity Environmentscited by 4
12 most cited of 21 All 21 (JSON)
- 2026Beyond Detection: Agentic Attack Synthesis and Simulation for Smart Contracts17 Jul 2026
- 2026IntentTester: Intent-Driven Multi-agent Framework for Cross-Library Test Migration24 Jun 2026
- 2026Functional Cache Grafting: Robust and Rapid Code-Policy Synthesis for Embodied Agents11 Jun 2026
- 2026SpaceVLN: A Zero-Shot Vision-and-Language Navigation Agent with Online Spatial Cognitive Memory and Reasoning8 Jun 2026
- 2026TDD Governance for Multi-Agent Code Generation via Prompt Engineering29 Apr 2026
- 2026ReCUBE: Evaluating Repository-Level Context Utilization in Code Generation26 Mar 2026
- 2026AI-for-Science Low-code Platform with Bayesian Adversarial Multi-Agent Framework3 Mar 2026
- 2025Collaborative Agents for Automated Program Repair in Ruby6 Nov 2025
- 2025Lang-PINN: From Language to Physics-Informed Neural Networks via a Multi-Agent Framework3 Oct 2025
- 2025VibeCodeHPC: An Agent-Based Iterative Prompting Auto-Tuner for HPC Code Generation Using LLMs26 Sep 2025
- 2025AI Agentic Programming: A Survey of Techniques, Challenges, and Opportunities15 Aug 2025
- 2025DefenderBench: A Toolkit for Evaluating Language Agents in Cybersecurity Environments31 May 2025
12 newest of 21 All 21 (JSON)
- 2025Give LLMs a Security Course: Securing Retrieval-Augmented Code Generation via Knowledge Injectioncited by 16
- 2025ARCS: Agentic Retrieval-Augmented Code Synthesis with Iterative Refinementcited by 7
- 2026Learning from Execution: Self-Evolving Memory for Private-Library Code Generationcited by 2
- 2026Repository-Level Solidity Code Generation with Large Language Models: From Prompting to Fine-Tuningcited by 0
- 2026Repository-Level Solidity Code Generation with Large Language Models: From Prompting to Fine-Tuning18 Jun 2026
- 2026Learning from Execution: Self-Evolving Memory for Private-Library Code Generation27 Apr 2026
- 2025ARCS: Agentic Retrieval-Augmented Code Synthesis with Iterative Refinement29 Apr 2025
- 2025Give LLMs a Security Course: Securing Retrieval-Augmented Code Generation via Knowledge Injection23 Apr 2025
- 2024EvoCodeBench: An Evolving Code Generation Benchmark Aligned with Real-World Code Repositoriescited by 72
- 2024DevEval: A Manually-Annotated Code Generation Benchmark Aligned with Real-World Code Repositoriescited by 72
- 2025AgentRxiv: Towards Collaborative Autonomous Researchcited by 72
- 2024Vul-RAG: Enhancing LLM-based Vulnerability Detection via Knowledge-level RAGcited by 68
- 2024Bugs in Large Language Models Generated Code: An Empirical Studycited by 60
- 2024Exploring and Unleashing the Power of Large Language Models in Automated Code Translationcited by 57
- 2025Large Language Models Hallucination: A Comprehensive Surveycited by 49
- 2024A Survey of Prompt Engineering Methods in Large Language Models for Different NLP Taskscited by 47
- 2023Large Language Model-Aware In-Context Learning for Code Generationcited by 43
- 2023Hot or Cold? Adaptive Temperature Sampling for Code Generation with Large Language Modelscited by 38
- 2024EvoCodeBench: An Evolving Code Generation Benchmark with Domain-Specific Evaluationscited by 34
- 2024Text-Tuple-Table: Towards Information Integration in Text-to-Table Generation via Global Tuple Extractioncited by 33
12 most cited of 85 All 85 (JSON)
- 2026SyRHM: Symbolic-Language-Enhanced Reasoning with Associative Retrieval for Zero-shot Harmful Meme Detection12 Sep 2026
- 2026CIT-CAD: Constraint Intent Tree-based CAD Code Generation and Verification7 Sep 2026
- 2026How Well Can AI Generate Backlogs from App Mockups?24 Jul 2026
- 2026Large Language Models for Code Generation from Multilingual Prompts: A Curated Benchmark and a Study on Code Quality16 Jul 2026
- 2026Quantize with Confidence? An Empirical Study of Quantization for Code Generation15 Jul 2026
- 2026Efficient Skill Grounding via Code Refactoring with Small Language Models6 Jun 2026
- 2026Framing Migration News with LLMs: Structured CoT as a Support for Human Interpretation2 Jun 2026
- 2026MAS-Algorithm: A Workflow for Solving Algorithmic Programming Problems with a Multi-Agent System7 May 2026
- 2026BODHI: Precise OS Kernel Specification Inference22 Apr 2026
- 2026Text2Model: Modeling Copilots for Text-to-Model Translation14 Apr 2026
- 2026DuET: Dual Execution for Test Output Prediction with Generated Code and Pseudocode13 Apr 2026
- 2026Static Program Slicing Using Language Models With Dataflow-Aware Pretraining and Constrained Decoding9 Apr 2026
12 newest of 85 All 85 (JSON)
Similar, not cited
Close in wording, no citation either way
- 2025Understanding Chain-of-Thought Effectiveness in Code Generation: An Empirical and Information-Theoretic Analysis
- 2025Are They All Good? Evaluating the Quality of CoTs in LLM-based Code Generation
- 2023Towards Better Chain-of-Thought Prompting Strategies: A Survey
- 2023Chain-Of-Thought Prompting Under Streaming Batch: A Case Study
- 2022Towards Understanding Chain-of-Thought Prompting: An Empirical Study of What Matters
- 2022Automatic Chain of Thought Prompting in Large Language Models
- 2025Prompt engineering and framework: implementation to increase code reliability based guideline for LLMs
- 2025MSCoT: Structured Chain-of-Thought Generation for Multiple Programming Languages