The invention discloses a
Java-to-Cangjie
code translation method based on a
large model and compilation feedback, and particularly belongs to the technical field of
software engineering program language
processing, and the method comprises the following steps: step 1, performing structured semantic pre-training by constructing a grammar
knowledge base of a target language, and injecting grammar prior knowledge of the target language; step 2, performing semantic enhanced supervision
fine tuning training by constructing a high-
quality data set containing
semantic information, and enhancing
semantic alignment and cross-language migration ability of the model; 3, introducing an AST structure
perception embedded prompt mechanism in a parallel corpus supervision
fine tuning training stage, and guiding the model to perform structure
perception translation; and 4, establishing a
compiler feedback repair loop, and iteratively correcting output based on error information to form a self-optimized closed-loop
system. According to the method, an efficient training path is constructed, dependence on large-scale
parallel corpora is effectively reduced, and an extensible and high-reliability technical path is provided for cross-
language code translation of low-resource
programming languages.