Structured parsing large language model task recursive scheduling method

CN123011249APending Publication Date: 2026-10-30CHENGDU KNOWLEDGE VISION SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611517197.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-29
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]本发明解决的技术问题是:现有技术受限于上下文窗口与单次推理能力,难以自动感知任务内部逻辑与层级依赖,导致生成内容易出现逻辑断裂、术语不一致、引用缺失等问题,且缺乏对任务粒度的自适应动态调整与闭环验证修正机制

Benefits of technology

[0047]本发明的有益效果:通过基于抽象语法树的任务递归拆解与复杂度评估机制,将复杂结构化生成任务分解为与模型当前能力边界相匹配的最小子任务,避免了因单次生成粒度过大而导致的上下文遗忘、逻辑断裂与术语不一致,提升了长文档与复杂方案的生成质量;利用上下文信息池和局部上下文动态组装技术,将全局生成工程裁剪为仅包含当前子任务所必需的最少必要知识,阻断了过多冗余信息对模型产生的干扰,确保生成内容符合强逻辑约束;建立了验证反馈驱动的闭环验证与自动修正体系,将局部诊断信息转化为负向反馈约束,动态修正结构化提示词并递归调用大模型重新生成,提升了复杂结构化内容生成的自动化程度与合规性;引入了基于验证反馈的任务粒度自适应降级拆分机制,当某一子任务反复触发验证错误并超出预设熔断阈值时,自动将任务进一步细化为多个次级子任务并重新调度,使任务复杂度强制回落至模型可靠生成的范围之内,防止生成流程陷入死循环,增强了系统的鲁棒性;在纠错过程中仅需替换局部抽象语法树节点,无需重构整个文档或系统方案,有效降低了单次大语言模型调用的Token消耗,减轻了算力负担,并避免了全局重构可能引入的不可控错误。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123011249A_ABST
    Figure CN123011249A_ABST
Patent Text Reader

Abstract

The application discloses a structured analysis large language model task recursive scheduling method, relates to the technical field of large language models, receives a target structured task, extracts a task structure framework by using a recursive descent analysis algorithm, and constructs a context information pool; an abstract syntax tree is generated according to the structure framework, and recursive traversal is carried out, a node to be generated is identified and disassembled into minimum subtasks, and a subtask queue is obtained; for the minimum subtasks, the local context of the corresponding node is extracted from the context information pool; the local context is dynamically assembled into a structured prompt word and issued to the large language model to generate a content segment of the corresponding subnode; the content segment is converted into an abstract syntax tree node and mounted and spliced into the abstract syntax tree; the abstract syntax tree after mounting and splicing is subjected to local structure checking, and a compilation result is output, and the application can automatically cope with the difficulty of a compilation task and accurately generate a scheduling task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of large language model technology, and in particular to a recursive scheduling method for structured parsing large language model tasks. Background Technology

[0002] With the application of artificial intelligence technology in fields such as healthcare and scientific research innovation, large language models are becoming one of the core elements for assisting in the production of medical knowledge and the design of scientific research programs.

[0003] In the field of medical knowledge platforms, tasks such as the structured writing of clinical guidelines, the automated generation of treatment pathways, and the systematic review and evidence chain construction of medical literature all exhibit highly structured, multi-level nested, and strongly logically constrained characteristics. Current large language models face significant bottlenecks when handling these complex structured tasks: limited by the length of the context window and single-inference capability, large models struggle to generate long documents or systematic solutions with multi-level nested structures and complex internal dependencies in a single call. Existing solutions often employ simple segmented generation or manual splitting strategies, lacking the ability to automatically perceive the internal structural relationships of the task, easily leading to quality issues such as logical breaks, inconsistent terminology, and missing citations among the generated content. In the practical application of medical knowledge platforms, the generation of medical content must strictly adhere to evidence-based medicine guidelines, drug incompatibilities rules, and clinical pathway standards; any local error can trigger systemic knowledge quality risks. Therefore, there is an urgent need for a large model scheduling method that can automatically parse task structure, intelligently split generation granularity, perceive contextual dependencies, and possess automatic verification and recursive correction capabilities for generated results. Structured parsing, abstract syntax tree construction, recursive traversal, and local verification methods in compiler technology offer novel technical approaches to solving the aforementioned problems. By using the abstract syntax tree approach to decompose the hierarchical structure of complex tasks as compilation units and analogizing output verification to compilation checks, a recursive scheduling method suitable for the field of medical knowledge generation is constructed. Summary of the Invention

[0004] The technical problem solved by this invention is that existing technologies are limited by context windows and single-inference capabilities, making it difficult to automatically perceive the internal logic and hierarchical dependencies of a task. This leads to problems such as logical breaks, inconsistent terminology, and missing references in the generated content. Furthermore, there is a lack of adaptive dynamic adjustment and closed-loop verification and correction mechanisms for task granularity.

[0005] To address the aforementioned technical problems, this invention provides the following technical solution: a recursive scheduling method for structured parsing large language model tasks, comprising the following steps:

[0006] Step S1: Receive the target structured task, extract the task structure skeleton using a recursive descent parsing algorithm, and construct a context information pool;

[0007] Step S2: Generate an abstract syntax tree based on the structural skeleton, and perform recursive traversal to identify the nodes to be generated and decompose them into the smallest subtasks to obtain the subtask queue.

[0008] Step S3: For the smallest subtask, extract the local context of the corresponding node from the context information pool;

[0009] Step S4: Dynamically assemble the local context into structured prompt words and send them to the large language model to generate content fragments for the corresponding child nodes;

[0010] Step S5: Convert the content fragment into an abstract syntax tree node and attach it to the abstract syntax tree;

[0011] Step S6: Perform local structure verification on the mounted and concatenated abstract syntax tree and output the compilation result.

[0012] Preferably, step S1 includes the following sub-steps:

[0013] Step S11: Receive the target structured task. For each compilation unit of the target structured task, use the recursive descent parsing algorithm to analyze it layer by layer to obtain the logical node declaration information, structure class definition information, global variable declaration information and specification dependency information of each compilation unit, and generate the original semantic information set.

[0014] Step S12: Perform recursive deep parsing on the original semantic information set: When a nested custom type is detected in a member field of the current data type, automatically recursively traverse the definition position of the current custom type and continue parsing until all member fields have been traversed, and then stop to generate a structured dependency chain.

[0015] Step S13: Construct a task structure skeleton based on the logical node declaration information and structured dependency chain. The task structure skeleton includes a function call relationship graph, a data flow dependency graph, and a file inclusion relationship graph. Traverse each node in the task structure skeleton, extract the symbol name, scope, symbol definition location, number of references, access modifiers, and parameter type information of each node, and index and store them according to the node number to obtain the context information pool.

[0016] Preferably, step S2 includes the following sub-steps:

[0017] Step S21: Take each node in the function call graph, data flow dependency graph and file inclusion graph in the task structure skeleton as a node of the abstract syntax tree, take the edges in each view as the connection relationship between nodes in the abstract syntax tree, merge the generated abstract syntax tree, perform a depth-first recursive traversal of the abstract syntax tree in a top-down order, compare the mapping relationship between the nodes in the abstract syntax tree and the task structure skeleton, extract the nodes in the abstract syntax tree that are missing specific content, and mark them as nodes to be generated;

[0018] Step S22: Extract the task complexity parameters of the nodes to be generated. The task complexity parameters include the node nesting depth, data dependency complexity, and estimated number of rules. Compare the task complexity parameters of each node to be generated with the preset minimum granularity threshold.

[0019] If the task complexity parameter of the node to be generated is greater than the minimum granularity threshold, continue to split the node to be generated downwards along the abstract syntax tree until the task complexity parameter of each child node obtained by the split is less than or equal to the minimum granularity threshold. Save the split child nodes to be generated and the nodes to be generated with less than the minimum granularity threshold as the minimum subtask.

[0020] Step S23: Based on the data flow dependency graph and function call relationship graph in the task structure skeleton, analyze the mutual dependencies between all minimum subtasks, including data flow dependencies and control flow dependencies; perform topological sorting on all minimum subtasks according to the mutual dependencies, the minimum subtasks include the first minimum subtask and the second minimum subtask, the sorting rule of the topological sorting is: when the first minimum subtask depends on the second minimum subtask, the second minimum subtask is arranged before the first minimum subtask, and all minimum subtasks are stored in the scheduling queue in sequence to generate a subtask queue.

[0021] Preferably, step S3 specifically includes:

[0022] Extract the smallest subtask to be processed from the subtask queue, and obtain the target node corresponding to the smallest subtask to be processed in the abstract syntax tree. Backtrack upwards along the target node in the abstract syntax tree to obtain the parent node type of the target node, and extract the sibling node information of the target node as sibling node constraints. According to the node number of the target node, perform an index query in the context information pool to match the symbol name and parameter type information that match the scope of the target node, and construct a knowledge element set from the matched symbol name and parameter type information. Combine the parent node type, sibling node constraints and knowledge element set into a local context.

[0023] Preferably, step S4 specifically includes:

[0024] Obtain a preset structured prompt template, which includes a task description field, a context information field, a constraint field, and an output format field; fill the target node's attribute information into the task description field, fill the local context into the context information field, and fill the sibling node constraints and knowledge element set in the local context into the constraint field; dynamically assemble the various fields of the structured prompt template to generate structured prompts;

[0025] The structured prompts are sent to the large language model, which processes them to generate corresponding content fragments.

[0026] Preferably, step S5 specifically includes:

[0027] The code parsing tool is invoked to perform syntax parsing and structural transformation on the content fragments, resulting in abstract syntax tree (AST) child nodes. The position of the target node is located in the AST, and the AST child nodes are attached and concatenated to the position of the target node in the AST. The missing specific code of the target node is replaced by the AST child nodes. Based on the attached and concatenated AST child nodes, the node connection relationship of the AST is updated, and the smallest subtask to be processed is updated to the completed processing status.

[0028] Preferably, step S6 includes the following sub-steps:

[0029] Step S61: Convert the abstract syntax tree into local structured text, call the preset rule validator to perform local compilation operation on the local structured text, and generate local compilation results;

[0030] Step S62: Perform local structure verification on the local compilation result. If the local structure verification passes, continue to schedule the next subtask in the subtask queue until all subtasks are compiled successfully and output the compilation result. If the local structure verification fails, automatically extract the compilation diagnostic information to correct the target prompt words, and recursively call the large language model to re-execute the mounting and local structure verification.

[0031] Preferably, step S62 specifically includes:

[0032] If the local structure check fails, the compilation diagnostic information is extracted from the local compilation result. The compilation diagnostic information is used as a negative feedback condition to fill the constraint condition field of the structured prompt word. The structured prompt word is updated using the filled constraint condition field to generate a corrected structured prompt word. The compilation diagnostic information includes the syntax error type and error triggering location.

[0033] The corrected structured prompts are resent to the large language model, which processes them to generate corrected content fragments.

[0034] The code parsing tool is invoked to perform syntax analysis and structural transformation on the corrected content fragment, resulting in new abstract syntax tree child nodes;

[0035] The new abstract syntax tree child node is attached and concatenated to the abstract syntax tree, replacing the abstract syntax tree child node in the abstract syntax tree. Then, the local compilation operation is returned and the attachment and local structure verification are recursively performed until the local compilation result indicates that the local structure verification has passed.

[0036] Preferably, the processing logic for passing the local structure verification is as follows:

[0037] If the local compilation result indicates that the local structure verification passed, check if there is an unprocessed minimum subtask in the subtask queue;

[0038] If there is an unprocessed smallest subtask in the subtask queue, extract the next unprocessed smallest subtask from the subtask queue and return to step S3 to continue scheduling the next smallest subtask in the subtask queue.

[0039] If all the smallest subtasks in the subtask queue have been processed and all corresponding local compilation results indicate that the local structure verification has passed, then the abstract syntax tree that has finally completed the replacement of all target nodes will be converted into a complete target structured document, and the target structured document will be output as the final compilation result.

[0040] Preferably, the recursive execution of mounting and local structure verification further includes adaptive degradation splitting of task granularity based on compilation feedback, specifically including:

[0041] Each time the corrected structured prompts are resent to the large language model, the number of retry calls for the smallest subtask being processed is recorded.

[0042] Compare the number of retry calls with the preset error circuit breaker threshold:

[0043] If the number of retry calls is... If the circuit breaker threshold is reached, continue generating the corrected content fragment;

[0044] If the number of retry calls is... If the error circuit breaker threshold is reached and the local compilation result still indicates that the local structure verification has failed, then the current recursive execution flow is intercepted, and it is determined that the task complexity of the target node corresponding to the smallest subtask being processed exceeds the single generation capability of the large language model.

[0045] Extract the abstract syntax tree substructure corresponding to the target node, and according to the preset syntax tree degradation splitting rules, further refine and decompose the currently processed smallest subtask into multiple subtasks, and analyze the data flow dependency relationship between the multiple subtasks.

[0046] Replace the smallest subtask currently being processed in the subtask queue with multiple secondary subtasks, sort the multiple secondary subtasks according to data flow dependencies, insert them at the front of the execution of the subtask queue, clear the retry call count, and return the multiple secondary subtasks to execution step S3.

[0047] The beneficial effects of this invention are as follows: By using a task recursive decomposition and complexity evaluation mechanism based on abstract syntax trees, complex structured generation tasks are decomposed into the smallest subtasks that match the current capability boundaries of the model. This avoids contextual forgetting, logical breaks, and terminological inconsistencies caused by excessively large granularity in a single generation, thus improving the generation quality of long documents and complex solutions. Utilizing a contextual information pool and local context dynamic assembly technology, the global generation process is trimmed to contain only the minimum necessary knowledge required for the current subtask, preventing excessive redundant information from interfering with the model and ensuring that the generated content conforms to strong logical constraints. A closed-loop verification and automatic correction system driven by verification feedback is established, transforming local diagnostic information into negative feedback constraints and dynamically correcting the results. By structuring prompts and recursively calling the large model for regeneration, the automation and compliance of generating complex structured content are improved. An adaptive degradation and splitting mechanism based on verification feedback is introduced. When a subtask repeatedly triggers verification errors and exceeds the preset circuit breaker threshold, the task is automatically further refined into multiple subtasks and rescheduled, forcing the task complexity back down to within the range of reliable model generation, preventing the generation process from getting stuck in an infinite loop, and enhancing the system's robustness. During the error correction process, only local abstract syntax tree nodes need to be replaced, without reconstructing the entire document or system solution. This effectively reduces the token consumption of a single large language model call, alleviates the computational burden, and avoids uncontrollable errors that may be introduced by global reconstruction. Attached Figure Description

[0048] Figure 1 The flowchart illustrates the steps of a recursive scheduling method for a large language model task using structured parsing, as provided in one embodiment of the present invention. Detailed Implementation

[0049] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0050] Example, refer to Figure 1This paper presents a recursive scheduling method for large language model tasks based on structured parsing, which includes the following steps:

[0051] Step S1: Receive the target structured task, extract the task structure skeleton using a recursive descent parsing algorithm, and construct a context information pool;

[0052] Step S2: Generate an abstract syntax tree based on the structural skeleton, and perform recursive traversal to identify the nodes to be generated and decompose them into the smallest subtasks to obtain the subtask queue.

[0053] Step S3: For the smallest subtask, extract the local context of the corresponding node from the context information pool;

[0054] Step S4: Dynamically assemble the local context into structured prompt words and send them to the large language model to generate content fragments for the corresponding child nodes;

[0055] Step S5: Convert the content fragment into an abstract syntax tree node and attach it to the abstract syntax tree;

[0056] Step S6: Perform local structure verification on the mounted and concatenated abstract syntax tree and output the compilation result.

[0057] Step S1 includes the following sub-steps:

[0058] Step S11: Receive the target structured task. For each compilation unit of the target structured task, use the recursive descent parsing algorithm to analyze it layer by layer to obtain the logical node declaration information, structure class definition information, global variable declaration information and specification dependency information of each compilation unit, and generate the original semantic information set.

[0059] Step S12: Perform recursive deep parsing on the original semantic information set: When a nested custom type is detected in a member field of the current data type, automatically recursively traverse the definition position of the current custom type and continue parsing until all member fields have been traversed, and then stop to generate a structured dependency chain.

[0060] Step S13: Construct a task structure skeleton based on the logical node declaration information and structured dependency chain. The task structure skeleton includes a function call relationship graph, a data flow dependency graph, and a file inclusion relationship graph. Traverse each node in the task structure skeleton, extract the symbol name, scope, symbol definition location, number of references, access modifiers, and parameter type information of each node, and index and store them according to the node number to obtain the context information pool.

[0061] In this embodiment, the storage path of the target structured task is received as input. Based on preset file type filtering rules, the compilation unit files to be parsed are selected, generating a list of files to be parsed. For example, for C / C++ projects, only source files with extensions ".c", ".cpp", ".h", and ".hpp" are retained; for Java projects, only source files with the extension ".java" are retained. For each compilation unit in the list of files to be parsed, a recursive descent parsing algorithm is used for layer-by-layer lexical and syntax analysis.

[0062] During the lexical analysis phase, the character stream of the source file is divided into several tokens according to the preset lexical rules. The types of tokens include keywords, identifiers, constants, operators, delimiters, and preprocessing instruction markers. Each token is stored in the form of a tuple, i.e. (token type, lexical value), and the line number and column number information of the token in the source file are also recorded.

[0063] During the syntax analysis phase, a corresponding parsing function is defined for each syntactic structure of the programming language to be parsed. These parsing functions include compiler unit parsing functions, function definition parsing functions, declaration parsing functions, statement parsing functions, and expression parsing functions. These parsing functions form a recursive call structure according to the syntactic hierarchy of the target language, constituting a complete recursive descent parser. Execution begins with the compiler unit parsing function, selecting the corresponding production path based on the type of the current lookahead token, and parsing downwards layer by layer. For terminal symbols in the path, the system verifies and consumes the current token; for non-terminal symbols in the path, the system recursively calls the corresponding sub-parsing function and attaches the syntax node information returned by the sub-parsing function to the current syntax node. After parsing all syntactic components, the system returns the syntactic node information it constructed. Whenever a syntactic structure is completely parsed, a corresponding reduction action is triggered to extract the semantic information of the syntactic structure. When a function definition is completely parsed, the system extracts its return type, function name, and parameter list, and records the start and end line numbers of the function definition. When a structure or class definition is completely parsed, the system extracts its type name and the type and name of each member field. When a global variable declaration is completely parsed, its data type and variable name are extracted. When a preprocessor include directive is encountered, the included canonical dependency name and include type are extracted. The extracted semantic information is formatted and temporarily stored in the original semantic information set of the current compilation unit.

[0064] In the recursive deep parsing process, the system first traverses all declarations of custom types in the original semantic information set. Custom types include structs, classes, unions, and enums. For each custom type, the system starts from the definition location of the type and checks the data type of each member field in turn. If the data type of the current member field is a custom type, the system uses the name of the custom type as the lookup key to locate its complete definition in the currently parsed context and the loaded dependency files. Then, it recursively enters the definition of the custom type and performs the same check and parsing on each of its member fields. This recursive process continues until all member fields are finally decomposed into basic data types, pointer types, or array types.

[0065] During this process, the system sets up a set of visited type tags to record the names of custom types that have been parsed. Once a custom type is fully parsed, the system immediately adds its name to the visited type tag set. Before recursively parsing a custom type each time, it first checks whether the type name already exists in the visited type tag set. If it does, the parsing of that type is skipped and the current recursive path is terminated to avoid infinite recursion caused by circular references between types.

[0066] In this embodiment, for structured generation tasks (such as clinical guidelines, treatment pathways, and evidence-based medicine chain construction) in the medical knowledge platform, the target structured task / standard description script describing the treatment logic or plan structure is received as input; a recursive descent parsing algorithm is used to perform layer-by-layer lexical and syntactic analysis on the treatment pathway unit file.

[0067] During the syntactic analysis phase, clinical diagnostic nodes, medication decision logic, examination and testing items, and drug incompatibilities rules are extracted from each medical knowledge unit. When a complete medical knowledge data structure or treatment branch node is parsed, its diagnostic classification, clinical indicator dependencies, and parameter constraints are extracted. When encountering complex disease or complication handling logic with multiple nested levels, its data members and rule dependencies are recursively and deeply parsed to generate a structured dependency chain and construct a task structure skeleton containing a clinical treatment flowchart, a data flow dependency graph, and a guideline inclusion relationship graph. Subsequently, a unified context information pool is established, and an index is assigned to each medical knowledge or treatment node to support fast querying of clinical indicators, drug types, and treatment constraints within the scope. Table 1 shows the storage format of the context information pool.

[0068] Table 1: Context Information Pool

[0069] Sym_001 Patient_Diagnosis_Node struct global utility.h:3 5 patient_id:ID, bp_sys:int, renal_status:enum Sym_002 Verify_Drug_Contraindication rule_func global utility.h:8 3 primary_drug:DrugID, alt_drug:DrugID bool

[0070] Step S2 includes the following sub-steps:

[0071] Step S21: Take each node in the function call graph, data flow dependency graph and file inclusion graph in the task structure skeleton as a node of the abstract syntax tree, take the edges in each view as the connection relationship between nodes in the abstract syntax tree, merge the generated abstract syntax tree, perform a depth-first recursive traversal of the abstract syntax tree in a top-down order, compare the mapping relationship between the nodes in the abstract syntax tree and the task structure skeleton, extract the nodes in the abstract syntax tree that are missing specific content, and mark them as nodes to be generated;

[0072] Step S22: Extract the nodes to be generated and calculate the task complexity parameters, including node nesting depth, data dependency complexity, and estimated number of rules. Compare the task complexity parameters of each node to be generated with the preset minimum granularity threshold.

[0073] If the task complexity parameter of the node to be generated is greater than the minimum granularity threshold, continue to split the node to be generated downwards along the abstract syntax tree until the task complexity parameter of each child node obtained by the split is less than or equal to the minimum granularity threshold. Save the split child nodes to be generated and the nodes to be generated that are less than or equal to the minimum granularity threshold as the minimum subtask.

[0074] Step S23: Based on the data flow dependency graph and function call relationship graph in the task structure skeleton, analyze the mutual dependencies between all minimum subtasks, including data flow dependencies and control flow dependencies; perform topological sorting on all minimum subtasks according to the mutual dependencies, the minimum subtasks include the first minimum subtask and the second minimum subtask, the sorting rule of the topological sorting is: when the first minimum subtask depends on the second minimum subtask, the second minimum subtask is arranged before the first minimum subtask, and all minimum subtasks are stored in the scheduling queue in sequence to generate a subtask queue.

[0075] In this embodiment, the function call graph, data flow dependency graph, and file inclusion graph in the task structure skeleton are first read. Using the file inclusion graph as the macro framework, the file nodes in the file inclusion graph are used as top-level module nodes; the logical node declaration nodes in the function call graph are used as sub-module nodes; and the variable nodes in the data flow dependency graph are used as leaf nodes. The nodes in each view are uniformly transformed into nodes in the abstract syntax tree, and the dependency edges in each view are transformed into connection relationships between nodes in the abstract syntax tree, thereby merging to generate a multi-dimensional abstract syntax tree. After fusion, the system performs a depth-first recursive traversal of the abstract syntax tree in a top-down order. During the traversal, the mapping relationship between the nodes in the abstract syntax tree and the task structure skeleton is compared. For example, when generating a node for a multi-drug combined treatment plan for hypertension and chronic kidney disease (CKD), it is found that there is a certain treatment path node in the abstract syntax tree, but when comparing the structure skeleton, it is found that it only records the diagnostic entry conditions and lacks specific drug dosage adjustment and contraindication filtering loop blocks. At this time, the node is marked as a node to be generated.

[0076] Extract the task complexity parameters for each node to be generated. The task complexity parameters include the node nesting depth. Data dependency complexity Estimated number of rules The data dependency complexity refers to the total number of external variables and input parameters referenced by the node. In this embodiment, the comprehensive complexity score of the node to be generated is used as its actual task complexity parameter. First, the corresponding weights of the node nesting depth, data dependency complexity, and estimated number of rules are calculated to obtain the first weight coefficient, the second weight coefficient, and the third weight coefficient. The first weight coefficient is obtained by analyzing the control flow divergence within the node to be generated. If the node contains simple sequential execution, the cognitive load of the large model is low. If it contains multiple switch-case or if-else branches, the cognitive load increases. In this embodiment, the number of control flow edges is used to determine the cognitive load. and syntax tree hierarchy Define the first weight coefficient :

[0077] ;

[0078] Analyze the external dependencies of the node references to be generated; for large models, tracking global variables or cross-file structure pointers is more error-prone than tracking local variables. The system extracts the number of external variables referenced across scopes. and the number of local variables The proportion of cross-scope variables is calculated as the second weighting coefficient. :

[0079] ;

[0080] The large language model exhibits significant attention decay when outputting longer content. The system presets the decay base λ=1.05, and the third weight coefficient is defined as a non-linear amplification factor of the number of lines.

[0081] ;

[0082] Using the dynamically calculated first, second, and third weighting coefficients, and combining them with the preset upper limit values ​​of each indicator for dimensional normalization, the basic indicators of the node to be generated are weighted and aggregated to obtain the task complexity parameter. :

[0083] ;

[0084] in, This represents the overall task complexity parameter for the node to be generated. For node nesting depth, For data dependency complexity, Estimated number of rules. , and These are the preset physical upper limit thresholds for the corresponding parameters, which are obtained in this embodiment. It is used to eliminate numerical scaling bias caused by differences in dimensions. , and These are the dynamic weight coefficients for the corresponding dimensions.

[0085] To ensure that the granularity of the decomposition matches the physical capability boundaries of the currently invoked large language model, a closed-loop feedback mechanism is used to dynamically generate the minimum granularity threshold. This involves obtaining the upper limit of the context tagging capacity of the currently accessed large language model, and reading the historical local compilation success rate of the scheduling system within the past time window to calculate the minimum granularity threshold. :

[0086] ;

[0087] in, Mark the capacity limit for the context. To improve the success rate of local compilation in history, The scaling factor is 0.15 in this embodiment;

[0088] The larger the context window of a large model, the higher the complexity of a single task that the system can allow to be issued; however, if the compilation of large models frequently fails in recent scheduling, that is... If the success rate drops, the minimum granularity threshold will be automatically lowered, forcing the task to be broken down into smaller pieces, thereby adaptively restoring the compilation pass rate.

[0089] Suppose the system is processing a node representing a combined treatment plan to be generated, with a node nesting depth D=4. This node includes multiple complication branching and dose step adjustment, and cross-references between external evidence-based databases and clinical drug contraindication databases, leading to a large number of external variables. =3, number of local variables =2, data dependency complexity is 5, estimated number of rows L=30, calculate dynamic weights:

[0090] The complexity of the control flow results in a first weighting coefficient of 1.8, the large number of external pointers results in a second weighting coefficient of 1.65, and the decay of the number of rows results in a third weighting coefficient of 2.45. The task complexity parameters for this node to be generated are calculated as follows: ;

[0091] At the same time, obtain the capacity of the current large model. =8192, and recently syntax tree mounting failures have been frequent, with historical local compilation success rates dropping to 60%. Calculate the current minimum granularity threshold: ;

[0092] Comparing the complexity parameter with the minimum granularity threshold, since... > The system determines that directly generating this complex diagnosis and treatment node in a single step is highly likely to cause logical breaks or drug contraindication illusions in the large model. Therefore, it continues to decompose the complex node downwards along the diagnosis and treatment logic boundary of the abstract syntax tree, breaking it down into three secondary minimum subtasks: subtask 1, kidney function index threshold verification and contraindication filtering node; subtask 2, preferred antihypertensive drug calculation and dose mapping node; and subtask 3, dynamic monitoring of combined drug interactions node. The complexity parameters of these three subtask nodes are reduced to 0.85, 0.62, and 0.95, respectively, all less than the current minimum granularity threshold of 1.17. Finally, these three decomposed sub-nodes to be generated are saved as minimum subtasks and enter the subsequent queue scheduling process. This embodiment, based on the decomposition mechanism of rigorous graph feature calculation and historical compilation pass rate feedback, solves the problems of context forgetting and dependency disorder when the large model processes structured code.

[0093] Step S3 specifically includes:

[0094] Extract the smallest subtask to be processed from the subtask queue, and obtain the target node corresponding to the smallest subtask to be processed in the abstract syntax tree. Backtrack upwards along the target node in the abstract syntax tree to obtain the parent node type of the target node, and extract the sibling node information of the target node as sibling node constraints. According to the node number of the target node, perform an index query in the context information pool to match the symbol name and parameter type information that match the scope of the target node, and construct a knowledge element set from the matched symbol name and parameter type information. Combine the parent node type, sibling node constraints and knowledge element set into a local context.

[0095] In this embodiment, the smallest subtask currently waiting to be processed is first extracted from the head of the subtask queue. It is assumed that the extracted smallest subtask to be processed is the dequeue and status verification node task obtained from the splitting process. The target node corresponding to the dequeue and status verification node in the fused abstract syntax tree is then obtained.

[0096] In the abstract syntax tree, the logical levels are traced back up along the memory pointer of the target node to obtain the parent node type of the target node. In the graph traversal scenario of this embodiment, the target node is located inside the loop structure, and the parent node type obtained by traversing back up is the While loop control statement.

[0097] Subsequently, the sibling node information of the target node is extracted as a sibling node constraint. Since the preceding execution logic of the target node has been instantiated or fixed in the abstract syntax tree, the generated code features of the sibling nodes preceding the target node are extracted. For example, the declaration state and data flow of the instantiated local variable traverse_queue in the preceding node are extracted, and the declaration state of the local variable traverse_queue is transformed into a sibling node constraint. The role of this sibling node constraint is to force the subsequent generated code to use the queue object that has been instantiated in the preceding node, and to never allow the introduction of undeclared variables with the same name.

[0098] Based on the node number of the target node, an index query is performed in the context information pool shown in Table 1, using it as the primary key. According to the scope visibility rules of the target language (such as C / C++ or Java), visible symbol names and parameter type information that fully conform to the scope of the target node are matched. Specifically, the system scans outward layer by layer to extract visible symbols in the global scope at the file level, such as matching the global graph structure pointer global_graph_context, the global result cache result_buffer and its corresponding pointer type and container type. At the same time, visible symbols in the local scope inside the function are extracted, such as the declared current processing node variable current_node. Private variables inside other irrelevant functions are filtered out. The matched fully legal symbol names and parameter type information are structured and packaged to form a knowledge element set.

[0099] Finally, the obtained parent node type, sibling node constraints, and knowledge element set, parent node type (i.e., the While loop control statement), sibling node constraints (i.e., constraints: reusing the instantiated queue object traverse_queue), and knowledge element set (i.e., usable symbols and types: global_graph_context, result_buffer, current_node) are combined according to key-value pairs or JSON format to generate a local context that strictly corresponds to the current target node.

[0100] Through the above processing, the system trims the originally massive global code project into a local context containing only the minimum necessary knowledge required by the current target node, thus preventing the possibility of a large language model generating logical illusions due to reading too much redundant global code.

[0101] Step S4 specifically includes:

[0102] Obtain a preset structured prompt template, which includes a task description field, a context information field, a constraint field, and an output format field; fill the target node's attribute information into the task description field, fill the local context into the context information field, and fill the sibling node constraints and knowledge element set in the local context into the constraint field; dynamically assemble the various fields of the structured prompt template to generate structured prompts;

[0103] The structured prompts are sent to the large language model, which processes them to generate corresponding content fragments.

[0104] This embodiment details how to utilize extracted micro-environment data to constrain the generation behavior of a large language model through a template mechanism, thereby avoiding code illusion. First, a preset structured prompt template is obtained. This template is defined using JSON format or Markdown tags. To prevent instruction confusion in the large language model, the structured prompt template is divided into independent task description, context information, constraint, and output format fields. Next, the attribute information of the target node is filled into the task description field. Specifically, the intent description parsed from the task structure skeleton is written into the task description field. Finally, the local context is filled into the context information field, notifying the large language model that the code logic to be generated is in a "While" state. Within the physical hierarchy of the loop control statement, and to achieve strict scope safety protection, the system extracts sibling node constraints and knowledge element sets from the local context and fills them into the constraint field as mandatory restrictions. Specifically, in the constraint field, the system writes: "Mandatory safety restrictions: First, the previously instantiated queue object traverse_queue must be used; Second, only the global graph structure pointer global_graph_context, the global result cache result_buffer, and the local variable current_node in the knowledge element set are allowed to be called within the current scope; Third, it is forbidden to introduce any third-party library variables not declared in the context or any undefined fake functions." In the output format field, it is specified that the large language model can only output pure content fragment text, filtering out all Markdown code block modifiers and any interpreted natural language. The system dynamically assembles the various fields of the filled structured prompt template to generate complete and clearly defined structured prompts.

[0105] Finally, the structured prompts are sent to the large language model via the API interface. The large language model performs self-attention calculation and inference prediction on the structured prompts, and generates content fragments of corresponding child nodes within the limited prompt space. The actual output and returned content fragment text of the large language model for the above structured prompts is as follows:

[0106] current_node = traverse_queue.front();traverse_queue.pop();if (!global_graph_context->is_visited(current_node)) { global_graph_context->mark_visited(current_node); result_buffer.push_back(current_node);}

[0107] This embodiment uses the strict logic of the compiler to drive the divergent generation of the large language model, ensuring that the content fragments generated by the large language model are absolutely safe and accurate in terms of symbolic references and variable dependencies.

[0108] Step S5 specifically includes:

[0109] The code parsing tool is invoked to perform syntax parsing and structural transformation on the content fragments, resulting in abstract syntax tree (AST) child nodes. The position of the target node is located in the AST, and the AST child nodes are attached and concatenated to the position of the target node in the AST. The missing specific code of the target node is replaced by the AST child nodes. Based on the attached and concatenated AST child nodes, the node connection relationship of the AST is updated, and the smallest subtask to be processed is updated to the completed processing status.

[0110] In this embodiment, since the content fragments output by the large language model are unstructured ordinary string text, directly using text concatenation can easily destroy the overall scope and syntax rules of the target structured task. Therefore, the system first calls the underlying code parsing tool, such as Clang Frontend for C / C++ target code, or the JavaParser framework for Java target code, to perform independent syntax parsing and structure transformation on the received content fragments. An isolated virtual parsing space is allocated in memory, and the content fragments are transformed into legal abstract syntax tree child nodes according to the syntax rules of the current target language. During the structure transformation process, the code parsing tool will automatically filter out any formatting marks or non-code characters that may remain in the content fragments and perform basic static syntax validity checks.

[0111] After obtaining a valid abstract syntax tree (API) child node, the system performs a depth-first search within the current API tree based on the pre-assigned globally unique node number of the target node. Once the target node's memory location is successfully located, the system performs a memory pointer redirection operation. This disconnects the pointers to child nodes held by the target node's parent node from the original target node and redirects them to the newly generated API child node. The API child node is then attached to the target node's location within the API tree. This API child node, containing the actual physical execution logic, completely replaces the original placeholder target node, which lacked concrete code.

[0112] After the replacement operation is completed, in order to ensure the overall semantic coherence of the abstract syntax tree, based on the attached and spliced ​​child nodes of the abstract syntax tree, the node connection relationship of the abstract syntax tree is updated: the connectivity of the scope linked list near the attachment position is recalculated, and the control flow graph dependency associations in the abstract syntax tree are refreshed to ensure that the newly introduced logical branches inside the child nodes of the abstract syntax tree can be normally perceived by the subsequent unprocessed nodes.

[0113] After the structured update of the abstract syntax tree is completed, the status flag of the smallest subtask currently pending in the task scheduling queue in memory is updated to the completed status, thereby notifying the system's task scheduler that the filling of the current vacant node is complete, which facilitates subsequent local structure verification and the next round of task distribution.

[0114] Step S6 includes the following sub-steps:

[0115] Step S61: Convert the abstract syntax tree into local structured text, call the preset rule validator to perform local compilation operation on the local structured text, and generate local compilation results;

[0116] Step S62: Perform local structure verification on the local compilation result. If the local structure verification passes, continue to schedule the next subtask in the subtask queue until all subtasks are compiled successfully and output the compilation result. If the local structure verification fails, automatically extract the compilation diagnostic information to correct the target prompt words, and recursively call the large language model to re-execute the mounting and local structure verification.

[0117] In this embodiment, after the abstract syntax tree (API) is mounted and assembled, isolated content fragments or local APIs often lack complete environment dependencies and cannot be directly recognized by the underlying compiler. Therefore, a reverse code generation tool (Unparser) is used to transform the local scope branches of the assembled API into local structured text. To ensure the local structured text has physical compatibility, the canonical dependency contents, global variable declarations, and outer function signatures corresponding to the local structured text are extracted from the context information pool. These canonical dependency contents are then used to sandbox and encapsulate the local structured text, generating a temporary compilation unit file. Subsequently, a preset rule validator is invoked to perform local compilation on the temporary compilation unit file-form local structured text. The exit status code and standard error output stream generated by the preset rule validator during execution are captured, and the exit status code and standard error output stream are packaged together to generate the local compilation result.

[0118] Perform local structure verification on the local compilation results. The system verifies whether the exit status code in the local compilation results is successful. A status code of 0 indicates success, while a non-zero code indicates a syntax or semantic error.

[0119] If the exit status code is not "compilation successful," the local structure check is deemed to have failed. At this point, using a preset regular expression, core compilation diagnostic information is automatically extracted from the standard error output stream of the local compilation result. This information includes the underlying syntax error types and error trigger locations. Syntax error types include incompatible pointer type assignments and undeclared variables. Error trigger locations can be represented as line numbers and error offsets. The extracted compilation diagnostic information is used as negative feedback constraints, filling the constraint field of the structured prompt word for the current processing task to correct the target prompt word. The corrected target prompt word is then redistributed, recursively calling the large language model to generate the repaired content fragment. The repaired content fragment is then used to re-execute the syntax tree node transformation, mounting and splicing, and local structure check actions. This recursive loop continues, using the compiler's rules to forcibly correct the logical illusions of the large language model until the local structure check passes.

[0120] If the exit status code indicates successful compilation, the local structure verification is deemed passed. The system confirms that the code logic of the current node fully conforms to the target language specification and there are no context dependency conflicts. Subsequently, the system notifies the task scheduler to continue scheduling the next subtask in the subtask queue, starting a new round of local code generation and verification process. This process continuously advances along the structure of the abstract syntax tree until all subtasks in the subtask queue are marked as completed and all subtasks pass the local structure verification. After all subtasks have compiled successfully, the entire fully instantiated abstract syntax tree is traversed, and the entire abstract syntax tree is uniformly transformed into a complete target program physical file. The complete target program physical file is then output as the final compilation result and delivered to the end user or downstream deployment environment.

[0121] Step S62 specifically includes:

[0122] If the local structure check fails, the compilation diagnostic information is extracted from the local compilation result. The compilation diagnostic information is used as a negative feedback condition to fill the constraint condition field of the structured prompt word. The structured prompt word is updated using the filled constraint condition field to generate a corrected structured prompt word. The compilation diagnostic information includes the syntax error type and error triggering location.

[0123] The corrected structured prompts are resent to the large language model, which processes them to generate corrected content fragments.

[0124] The code parsing tool is invoked to perform syntax analysis and structural transformation on the corrected content fragment, resulting in new abstract syntax tree child nodes;

[0125] The new abstract syntax tree child node is attached and concatenated to the abstract syntax tree, replacing the abstract syntax tree child node in the abstract syntax tree. Then, the local compilation operation is returned and the attachment and local structure verification are recursively performed until the local compilation result indicates that the local structure verification has passed.

[0126] In this embodiment, traditional large language model code generation technology typically requires manual intervention to review error messages and modify prompts when encountering logical illusions or type mismatches. This embodiment, however, automatically extracts underlying compiler diagnostic information, particularly precise syntax error types and error trigger locations, and transforms them into negative feedback conditions that the large language model can understand. This achieves deep complementarity between the compiler and the large language model. The entire error correction process requires no manual intervention, relying on compiler errors to drive the large language model's self-evolution and correction, thereby improving the success rate and engineering efficiency of structured code generation.

[0127] When a part of the code fails to be generated, this embodiment does not require the large language model to regenerate the entire file or module code. Instead, it precisely locates the local correction content fragment that caused the error and generates a new abstract syntax tree child node, which greatly reduces the token consumption of a single large language model call, alleviates the computing power burden, and effectively prevents new uncontrollable logical errors from being introduced due to global reconstruction.

[0128] This embodiment requires that a replacement operation must be performed when attaching a new child node of the abstract syntax tree to the abstract syntax tree. This ensures that the abstract syntax tree will not expand due to the attachment of incorrect nodes or generate incorrect branches when multiple recursive retries occur. Through pointer replacement and memory cleanup, a high-quality target program is finally output.

[0129] The processing logic for passing the local structure verification is as follows:

[0130] If the local compilation result indicates that the local structure verification passed, check if there is an unprocessed minimum subtask in the subtask queue;

[0131] If there is an unprocessed smallest subtask in the subtask queue, extract the next unprocessed smallest subtask from the subtask queue and return to step S3 to continue scheduling the next smallest subtask in the subtask queue.

[0132] If all the smallest subtasks in the subtask queue have been processed and all corresponding local compilation results indicate that the local structure verification has passed, then the abstract syntax tree that has finally completed the replacement of all target nodes will be converted into a complete target structured document, and the target structured document will be output as the final compilation result.

[0133] In this embodiment, after the local compilation result indicates that the local structure verification has passed, the currently mounted and assembled abstract syntax tree child node is completely reasonable in terms of syntax rules and local dependencies. After the local structure verification passes, the task scheduler sends a status query instruction to the subtask queue, traverses and checks the task status flags in the subtask queue, and queries whether there is a smallest subtask marked as unprocessed in the subtask queue:

[0134] If the query results show that there are unprocessed minimum subtasks in the subtask queue, the next unprocessed minimum subtask is extracted from the execution head of the subtask queue according to the topological sorting order pre-completed in step S2. After extraction, the system control scheduling execution flow automatically returns to execution step S3. For the extracted next unprocessed minimum subtask, the corresponding local context data is re-matched and extracted from the context information pool, and the scheduling of the next minimum subtask in the subtask queue continues. As the scheduling flow continues to advance, if it is detected that all minimum subtasks in the subtask queue have been processed, and all corresponding local compilation results indicate that the local structure verification has passed, the process continues. Then, all target nodes in the abstract syntax tree that were originally missing specific code have been filled in. The backend code generation engine is then invoked. Following the lexical and grammatical rules of the target programming language, the engine performs a full depth-first traversal of the abstract syntax tree, which has now had all target nodes replaced. The memory tree structure of the abstract syntax tree is serialized and converted into plain text format, such as .c, .h, or .java source files containing complete medical entity definitions, class definitions, function implementation logic, and correctly referenced files. Finally, the complete target structured document is saved to the specified disk path, and the target structured document is output as the final compilation result, delivered to the downstream build toolchain. Through the above processing, this embodiment integrates the fragmented generation capability of a large language model with traditional compilers, achieving reliable code generation.

[0135] The recursive execution of mounting and local structure verification also includes adaptive degradation splitting of task granularity based on compilation feedback, specifically including:

[0136] Each time the corrected structured prompts are resent to the large language model, the number of retry calls for the smallest subtask being processed is recorded.

[0137] Compare the number of retry calls with the preset error circuit breaker threshold:

[0138] If the number of retry calls is... If the circuit breaker threshold is reached, continue generating the corrected content fragment;

[0139] If the number of retry calls is... If the error circuit breaker threshold is reached and the local compilation result still indicates that the local structure verification has failed, then the current recursive execution flow is intercepted, and it is determined that the task complexity of the target node corresponding to the smallest subtask being processed exceeds the single generation capability of the large language model.

[0140] Extract the abstract syntax tree substructure corresponding to the target node, and according to the preset syntax tree degradation splitting rules, further refine and decompose the currently processed smallest subtask into multiple subtasks, and analyze the data flow dependency relationship between the multiple subtasks.

[0141] Replace the smallest subtask currently being processed in the subtask queue with multiple subtasks, sort the multiple subtasks according to the data flow dependency, insert them into the execution front of the subtask queue, clear the retry call count, and return the multiple subtasks to execution step S3.

[0142] During the recursive execution of mounting and local structure verification, the system maintains a counter in memory for the smallest subtask currently being processed. Each time the corrected structured prompt is resent to the large language model, the system controls the counter to increment, thereby recording the number of retry calls for the smallest subtask currently being processed.

[0143] The default fault circuit breaker threshold is 3 times. After each call, the number of retries is compared with the fault circuit breaker threshold. If the comparison result is the same as the number of retries, the circuit breaker will terminate. If the error trigger threshold is reached and it is determined that the large language model still has the potential to self-repair the code through fine-tuning of prompt words, the normal process will not be interfered with, and the step of generating the corrected content fragment will continue.

[0144] If the comparison result shows that the number of retry calls is greater than the error circuit breaker threshold, and the local compilation result still indicates that the local structure verification has failed, it means that the current structured prompt word constraints cannot guide the model to generate correct code. At this time, the circuit breaker protection is triggered, the current recursive execution flow is forcibly intercepted, and it is determined that the task complexity of the target node corresponding to the smallest subtask being processed exceeds the single generation capability boundary of the large language model under the current context window constraint.

[0145] After the circuit breaker is triggered, the abstract syntax tree substructure corresponding to the target node is extracted, and the syntax tree degradation splitting rules are invoked. The syntax tree degradation splitting rules include:

[0146] Nested logic compound statements are broken down into flat sequential statements, complex mathematical calculations are broken down into intermediate assignment statements with temporary variables, and filtering and sorting dual logic is divided into two independent loop blocks; according to the syntax tree degradation splitting rules, the smallest subtask currently being processed is further refined and broken down into multiple subtasks.

[0147] For example, the smallest subtask originally issued by the system was adaptive dose adjustment and interaction verification of complex multi-drug combination prescriptions. Due to the overly complex logic involving the joint judgment of multiple indicators, the code generated by the large language model failed to pass local compilation / medical rule verification multiple times. For example, scope variable confusion or drug compatibility logic dead loops occurred repeatedly. The number of retry calls exceeded the preset circuit breaker threshold (3 times), triggering the system circuit breaker.

[0148] At this point, the system intercepts the current process, determines that the complexity of the diagnosis and treatment node has exceeded the reliable generation boundary of the model in a single attempt, and initiates the syntax tree degradation and splitting mechanism to decompose the complex task into three related sub-tasks: verification of key indicators of the patient's liver and kidney function and drug contraindication thresholds, calculation of the basic dosage and step-by-step increment logic based on evidence-based medicine rules, and secondary drug interaction assessment and alternative solution generation. After analyzing the data flow dependencies between these three sub-tasks, they are reordered and inserted into the front of the scheduling queue, the retry count is cleared, and the micro-local context is re-extracted for recursive scheduling, forcibly reducing the generation complexity to within the range of reliable output of the large model.

[0149] After the decomposition is completed, the data flow dependencies between these multiple subtasks are analyzed. For example, subtask 3 is strongly dependent on the memory allocated by subtask 2 and the verification result of subtask 1 in terms of data reading and writing.

[0150] Multiple subtasks are used to replace the smallest subtask currently being processed that is causing an infinite loop in the subtask queue. Simultaneously, the multiple subtasks are ordered according to the analyzed data flow dependencies, and the ordered subtasks are inserted at the front of the subtask queue to ensure that the system processes these refined tasks immediately in the next step. Finally, the retry count for the subtasks is reset to 0, and the multiple subtasks are returned to execution step S3 to extract smaller local contexts for these subtasks.

[0151] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the protection scope of the present invention.

Claims

1. A recursive scheduling method for a large language model task based on structured parsing, characterized in that, Includes the following steps: Step S1: Receive the target structured task, extract the task structure skeleton using a recursive descent parsing algorithm, and construct a context information pool; Step S2: Generate an abstract syntax tree based on the structural skeleton, and perform recursive traversal to identify the nodes to be generated and decompose them into the smallest subtasks. Step S3: For the smallest subtask, extract the local context of the corresponding node from the context information pool; Step S4: Dynamically assemble the local context into structured prompt words and send them to the large language model to generate content fragments for the corresponding child nodes; Step S5: Convert the content fragment into an abstract syntax tree node and attach it to the abstract syntax tree; Step S6: Perform local structure verification on the mounted and concatenated abstract syntax tree and output the compilation result.

2. The recursive scheduling method for a large language model task using structured parsing as described in claim 1, characterized in that, Step S1 includes the following sub-steps: Step S11: Receive the target structured task. For each compilation unit of the target structured task, use the recursive descent parsing algorithm to analyze it layer by layer to obtain the logical node declaration information, structure class definition information, global variable declaration information and specification dependency information of each compilation unit, and generate the original semantic information set. Step S12: Perform recursive deep parsing on the original semantic information set: When a nested custom type is detected in a member field of the current data type, automatically recursively traverse the definition position of the current custom type and continue parsing until all member fields have been traversed, and then stop to generate a structured dependency chain. Step S13: Construct a task structure skeleton based on the logical node declaration information and structured dependency chain. The task structure skeleton includes a function call relationship graph, a data flow dependency graph, and a file inclusion relationship graph. Traverse each node in the task structure skeleton, extract the symbol name, scope, symbol definition location, number of references, access modifiers, and parameter type information of each node, and index and store them according to the node number to obtain the context information pool.

3. The recursive scheduling method for a large language model task using structured parsing as described in claim 2, characterized in that, Step S2 includes the following sub-steps: Step S21: Take each node in the function call graph, data flow dependency graph and file inclusion graph in the task structure skeleton as a node of the abstract syntax tree, take the edges in each view as the connection relationship between nodes in the abstract syntax tree, merge the generated abstract syntax tree, perform a depth-first recursive traversal of the abstract syntax tree in a top-down order, compare the mapping relationship between the nodes in the abstract syntax tree and the task structure skeleton, extract the nodes in the abstract syntax tree that are missing specific content, and mark them as nodes to be generated; Step S22: Extract the task complexity parameters of the nodes to be generated. The task complexity parameters include the node nesting depth, data dependency complexity, and estimated number of rules. Compare the task complexity parameters of each node to be generated with the preset minimum granularity threshold. If the task complexity parameter of the node to be generated is greater than the minimum granularity threshold, continue to split the node to be generated downwards along the abstract syntax tree until the task complexity parameter of each child node obtained by the split is less than or equal to the minimum granularity threshold. Save the split child nodes to be generated and the nodes to be generated with less than the minimum granularity threshold as the minimum subtask. Step S23: Based on the data flow dependency graph and function call relationship graph in the task structure skeleton, analyze the mutual dependencies between all minimum subtasks, including data flow dependencies and control flow dependencies; perform topological sorting on all minimum subtasks according to the mutual dependencies, the minimum subtasks include the first minimum subtask and the second minimum subtask, the sorting rule of the topological sorting is: when the first minimum subtask depends on the second minimum subtask, the second minimum subtask is arranged before the first minimum subtask, and all minimum subtasks are stored in the scheduling queue in sequence to generate a subtask queue.

4. The recursive scheduling method for a large language model task using structured parsing as described in claim 3, characterized in that, Step S3 specifically includes: Extract the smallest subtask to be processed from the subtask queue, and obtain the target node corresponding to the smallest subtask to be processed in the abstract syntax tree. Backtrack upwards along the target node in the abstract syntax tree to obtain the parent node type of the target node, and extract the sibling node information of the target node as sibling node constraints. According to the node number of the target node, perform an index query in the context information pool to match the symbol name and parameter type information, and construct a knowledge element set from the matched symbol name and parameter type information. Combine the parent node type, sibling node constraints and knowledge element set into a local context.

5. The recursive scheduling method for a large language model task using structured parsing as described in claim 4, characterized in that, Step S4 specifically includes: Obtain a preset structured prompt template, which includes a task description field, a context information field, a constraint field, and an output format field; fill the target node's attribute information into the task description field, fill the local context into the context information field, and fill the sibling node constraints and knowledge element set in the local context into the constraint field; dynamically assemble the various fields of the structured prompt template to generate structured prompts; The structured prompts are sent to the large language model, which processes them to generate corresponding content fragments.

6. The recursive scheduling method for a large language model task using structured parsing as described in claim 5, characterized in that, Step S5 specifically includes: The code parsing tool is invoked to perform syntax parsing and structural transformation on the content fragments, resulting in abstract syntax tree (AST) child nodes. The position of the target node is located in the AST, and the AST child nodes are attached and concatenated to the position of the target node in the AST. The missing specific code of the target node is replaced by the AST child nodes. Based on the attached and concatenated AST child nodes, the node connection relationship of the AST is updated, and the smallest subtask to be processed is updated to the completed processing status.

7. The recursive scheduling method for a large language model task using structured parsing as described in claim 6, characterized in that, Step S6 includes the following sub-steps: Step S61: Convert the abstract syntax tree into local structured text, call the preset rule validator to perform local compilation operation on the local structured text, and generate local compilation results; Step S62: Perform local structure verification on the local compilation result. If the local structure verification passes, continue to schedule the next subtask in the subtask queue until all subtasks are compiled successfully and output the compilation result. If the local structure verification fails, automatically extract the compilation diagnostic information to correct the target prompt words, and recursively call the large language model to re-execute the mounting and local structure verification.

8. The recursive scheduling method for a large language model task using structured parsing as described in claim 7, characterized in that, Step S62 specifically includes: If the local structure check fails, the compilation diagnostic information is extracted from the local compilation result. The compilation diagnostic information is used as a negative feedback condition to fill the constraint condition field of the structured prompt word. The structured prompt word is updated using the filled constraint condition field to generate a corrected structured prompt word. The compilation diagnostic information includes the syntax error type and error triggering location. The corrected structured prompts are resent to the large language model, which processes them to generate corrected content fragments. The code parsing tool is invoked to perform syntax analysis and structural transformation on the corrected content fragment, resulting in new abstract syntax tree child nodes; The new abstract syntax tree child node is attached and concatenated to the abstract syntax tree, replacing the abstract syntax tree child node in the abstract syntax tree. Then, the local compilation operation is returned and the attachment and local structure verification are recursively performed until the local compilation result indicates that the local structure verification has passed.

9. The recursive scheduling method for a large language model task using structured parsing as described in claim 8, characterized in that, The processing logic for passing the local structure verification is as follows: If the local compilation result indicates that the local structure verification passed, check if there is an unprocessed minimum subtask in the subtask queue; If there is an unprocessed smallest subtask in the subtask queue, extract the next unprocessed smallest subtask from the subtask queue and return to step S3 to continue scheduling the next smallest subtask in the subtask queue. If all the smallest subtasks in the subtask queue have been processed and all corresponding local compilation results indicate that the local structure verification has passed, then the abstract syntax tree that has finally completed the replacement of all target nodes will be converted into a complete target structured document, and the target structured document will be output as the final compilation result.

10. The recursive scheduling method for a large language model task using structured parsing as described in claim 9, characterized in that, The recursive execution of mounting and local structure verification also includes adaptive degradation splitting of task granularity based on compilation feedback, specifically including: Each time the corrected structured prompts are resent to the large language model, the number of retry calls for the smallest subtask being processed is recorded. Compare the number of retry calls with the preset error circuit breaker threshold: If the number of retry calls is... If the circuit breaker threshold is reached, continue generating the corrected content fragment; If the number of retry calls is... If the error circuit breaker threshold is reached and the local compilation result still indicates that the local structure verification has failed, then the current recursive execution flow is intercepted, and it is determined that the task complexity of the target node corresponding to the smallest subtask being processed exceeds the single generation capability of the large language model. Extract the abstract syntax tree substructure corresponding to the target node, and according to the preset syntax tree degradation splitting rules, further refine and decompose the currently processed smallest subtask into multiple subtasks, and analyze the data flow dependency relationship between the multiple subtasks. Replace the smallest subtask currently being processed in the subtask queue with multiple subtasks, sort the multiple subtasks according to the data flow dependency, insert them into the execution front of the subtask queue, clear the retry call count, and return the multiple subtasks to execution step S3.