The invention relates to the technical field of
computer programming, and discloses a code repairing method and device based on an
abstract syntax tree and a
large model, and the method comprises the steps: carrying out grammar inspection on a to-be-repaired code, repairing a grammar problem, and generating a preliminary repairing code; compiling and verifying the preliminary repair code, and matching compiling error information based on an error rule
knowledge base to obtain a repair rule when a compiling error occurs; repairing the
abstract syntax tree of the preliminary repair code by utilizing a repair rule until the preliminary repair code passes compilation
verification to obtain a target repair code, and performing operation
verification; and when the running error is detected, calling a preset large
language model based on the running error information to diagnose and repair until the running
verification is passed. According to the method, the code error repairing efficiency is improved,
abstract syntax tree analysis and large
language model repairing are combined, the
processing capacity and repairing precision of deep semantic errors and unknown running errors are enhanced, and the code quality, reliability and development efficiency are improved.