We present the Code Documentation and Analysis Tool (CoDAT). CoDAT is a tool designed to maintain consistency between the various levels of code documentation, e.g. if a line in a code sketch is changed, the comment that documents the corresponding code is also changed. That is, comments are linked and updated so as to remain internally consistent and also consistent with the code. By flagging "out of date" comments, CoDAT alerts the developer to maintain up-to-date documentation. We use a large language model to check the semantic consistency between a fragment of code and the comments that describe it. Thus we also flag semantic inconsistency as well as out of date comments. This helps programers write code that correctly implements a code sketch, and so provides machine support for a step-wise refinement approach, starting with a code sketch and proceeding down to code through one or more refinement iterations. CoDAT is implemented in the Intellij IDEA IDE where we use the Code Insight daemon package alongside a custom regular expression algorithm to mark tagged comments whose corresponding code blocks have changed. CoDAT's backend is structurally decentralized to allow a distributed ledger framework for code consistency and architectural compilation tracking.
翻译:本文介绍代码文档与分析工具(CoDAT)。该工具旨在维护不同层级代码文档之间的一致性,例如当代码草图中的某行被修改时,对应代码段的注释也会同步更新。通过建立注释间的关联并保持动态更新,系统确保文档内部一致性以及与代码的同步性。CoDAT通过标记"过时注释"提醒开发者维护最新文档。我们采用大语言模型检测代码片段与其描述注释之间的语义一致性,从而同时标记语义不一致和过时注释。这有助于程序员编写正确实现代码草图的程序,为逐步求精的开发方法提供机器支持——从代码草图出发,通过一次或多次迭代精化直至生成最终代码。CoDAT在Intellij IDEA集成开发环境中实现,结合Code Insight守护进程包与定制正则表达式算法,可标记对应代码块已变更的标签化注释。其后端采用结构化去中心化架构,支持基于分布式账本的代码一致性维护与架构编译追踪框架。