Flow code debugging method, system and device, and storage medium

By using generator tree technology to parse and debug instructions, code in the generator tree can be run directly, solving the problem that existing RPA products cannot dynamically modify code during debugging, and achieving efficient process code debugging.

CN116225924BActive Publication Date: 2026-01-02GUANGZHOU YUNDI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310136060.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-17
Publication Date
2026-01-02
Estimated Expiration
2043-02-17

AI Technical Summary

Technical Problem

Existing RPA products' debugging functions cannot dynamically modify code and make it take effect immediately, resulting in high debugging time costs, which is particularly unfriendly in long-term processes.

Method used

The process code is parsed by an abstract syntax analyzer to generate a generator tree. After obtaining debugging instructions, the starting node and context information are determined, and the code in the generator tree is run directly to avoid running it from the beginning.

Benefits of technology

It reduces the time cost of debugging process code, improves debugging efficiency, and makes code changes take effect immediately without having to re-execute the entire process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116225924B_ABST
    Figure CN116225924B_ABST
Patent Text Reader

Abstract

The application discloses a flow code debugging method, system and device and a storage medium, and relates to the technical field of computers. The flow code debugging method comprises the following steps: parsing flow code to be debugged through an abstract syntax analyzer to obtain component code; traversing the component code and converting the component code into a plurality of generators to obtain a generator tree; obtaining a debugging instruction and determining a first generator tree to be debugged and a start node according to the debugging instruction; starting and traversing the first generator tree to be debugged; when the start node is traversed, obtaining and loading context information of a previous run on the first generator tree, and running code corresponding to a generator where the start node is located. The application can reduce the time cost of flow code debugging.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, and in particular, to a process code debugging method, system, device and storage medium. BACKGROUND

[0002] Robotic process automation (RPA) is a business process automation technology based on software robots and artificial intelligence (AI). The RPA system is an application program that provides another way to automate the end user's manual operation process by simulating the end user's manual operation on the computer.

[0003] The debugging function of the current RPA product is mainly realized based on the debugging module (pdb) provided by python. The pdb loads the python code to be debugged into the memory before debugging. The modification of the source file code during the debugging process will not affect the code that has been loaded into the memory. At the same time, the python interpreter is executed in sequence, and it is not possible to bypass part of the code and directly jump to the breakpoint to start execution. Therefore, although the process code compilation and running can support functions such as breakpoint, continue, next step, etc., it is still not possible to dynamically modify the code during the debugging process and make it take effect immediately. Each time the code is modified, it must be run from the beginning to take effect. In the case of a long process, the debugging of the process is very unfriendly, and the time cost of debugging is increased. SUMMARY

[0004] The present application aims to at least solve one of the technical problems existing in the prior art. To this end, the present application provides a process code debugging method, system, device and storage medium, which can reduce the time cost of process code debugging.

[0005] In one aspect, the present application embodiment provides a process code debugging method, comprising the following steps:

[0006] The process code to be debugged is parsed by an abstract syntax analyzer to obtain component code;

[0007] The component code is traversed and converted into a plurality of generators to obtain a generator tree;

[0008] A debugging instruction is obtained, and a first generator tree to be debugged and a start node are determined according to the debugging instruction;

[0009] The first generator tree to be debugged is started and traversed;

[0010] When the start node is traversed, the context information of the last run on the first generator tree is obtained and loaded, and the code corresponding to the generator where the start node is located is run.

[0011] According to some embodiments of the present application, the parsing the flow code to be debugged by the abstract syntax analyzer to obtain component code comprises the following steps:

[0012] Extracting key information and parameters in the flow code by the abstract syntax analyzer;

[0013] Assembling and converting the format of the key information and the parameters to obtain the component code.

[0014] According to some embodiments of the present application, the traversing the component code and converting the component code into multiple generators to obtain a generator tree comprises the following steps:

[0015] Traversing the component code and judging the unit type to which the current code unit belongs;

[0016] Generating a generator corresponding to the unit type according to the unit type and executing corresponding traversal logic according to the unit type;

[0017] Determining the superior-inferior relationship between the generators according to the traversal logic;

[0018] Determining a generator tree according to the superior-inferior relationship between the generators.

[0019] According to some embodiments of the present application, the unit type comprises a normal component, a loop container, an exception capture container, a judgment branch container, a custom code block, and a sub-flow calling component, and the generator comprises a basic generator, a loop generator, an exception capture generator, a conditional judgment generator, an automatic code block generator, and a sub-flow calling generator.

[0020] According to some embodiments of the present application, the traversal logic comprises first traversal logic and second traversal logic, the first traversal logic is to traverse the next group of code units outside the current code unit, and the second traversal logic is to traverse the code inside the current code unit.

[0021] When the unit type to which the current code unit belongs is a normal component, a basic generator is generated and the first traversal logic is executed.

[0022] When the unit type to which the current code unit belongs is one of a loop container, an exception capture container, a judgment branch container, a custom code block, and a sub-flow calling component, a corresponding generator is generated and the second traversal logic is executed.

[0023] According to some embodiments of the present application, the flow code debugging method further comprises the following steps:

[0024] In response to the debugging instruction, a second generator tree currently being iterated is closed, and current context information of the second generator tree is saved.

[0025] According to some embodiments of the present application, the starting and traversing the first generator tree to be debugged comprises the following steps:

[0026] According to the start node, a node level mapping table of the first generator tree is searched to determine a hierarchy corresponding to the start node;

[0027] The first generator tree is started and traversed according to the hierarchy.

[0028] In another aspect, embodiments of the present application further provide a flow code debugging system, comprising:

[0029] A first module is configured to parse flow code to be debugged by an abstract syntax analyzer to obtain component code;

[0030] A second module is configured to traverse the component code and convert the component code into a plurality of generators to obtain a generator tree;

[0031] A third module is configured to acquire a debugging instruction and determine a first generator tree to be debugged and a start node according to the debugging instruction;

[0032] A fourth module is configured to start and traverse the first generator tree to be debugged;

[0033] A fifth module is configured to, when the start node is reached, acquire and load context information of a previous run of the first generator tree, and run code corresponding to a generator in which the start node is located.

[0034] In another aspect, embodiments of the present application further provide a flow code debugging device, comprising:

[0035] At least one processor;

[0036] At least one memory configured to store at least one program;

[0037] When the at least one program is executed by the at least one processor, the at least one processor implements the flow code debugging method as described above.

[0038] In another aspect, embodiments of the present application further provide a computer readable storage medium, which stores computer executable instructions, and the computer executable instructions are configured to cause a computer to execute the flow code debugging method as described above.

[0039] The technical scheme has at least one of the following advantages or beneficial effects: the flow code to be debugged is converted into a generator tree by an abstract syntax analyzer, the flow code is debugged based on the generator tree, after a debugging instruction is obtained, a first generator tree to be debugged and a start node are determined according to the debugging instruction, the first generator tree to be debugged is started and traversed, when the start node is traversed, context information of a previous run on the first generator tree is obtained and loaded, and the code corresponding to the generator where the start node is located is run, so that the running starts from the generator where the start node is located, the flow code debugging time is reduced. BRIEF DESCRIPTION OF DRAWINGS

[0040] Figure 1 is a flow code debugging method flowchart provided by an embodiment of the present application;

[0041] Figure 2 is a flow code schematic diagram of a front-end interactive interface provided by an embodiment of the present application;

[0042] Figure 3 is a component code schematic diagram of a loop container provided by an embodiment of the present application;

[0043] Figure 4 is a loop generator schematic diagram provided by an embodiment of the present application;

[0044] Figure 5 is a generator tree schematic diagram obtained by converting the flow code in Figure 2

[0045] Figure 6 is a flow code debugging device schematic diagram provided by an embodiment of the present application. DETAILED DESCRIPTION

[0046] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the drawings, wherein the same or similar notations represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary and are only used to explain the present application, and cannot be understood as a limitation of the present application.

[0047] In the description of the present application, it should be understood that the orientation description, such as the orientation or position relationship indicated by up, down, left, right, etc., is based on the orientation or position relationship shown in the drawings, and is only for the convenience of describing the present application and simplifying the description, and does not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation of the present application.

[0048] ​In the description of the present application, if first, second, etc. are described, it is only for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features or the sequence of indicated technical features.

[0049] Generator, the function using yield in Python can be called generator. Generator is a function returning iterator, which can only be used for iteration operation. The advantage of generator is that it can calculate while looping, and will not generate large data at the same time, saving memory space. Generator is a data structure that can realize infinite loop.

[0050] Abstract syntax analyzer, namely Abstract Syntax Tree (AST), or simply Syntax tree, is an abstract representation of the syntax structure of source code. It represents the syntax structure of programming language in the form of tree, and each node on the tree represents a structure in the source code. The reason why the syntax is "abstract" is that the syntax does not represent every detail in the real syntax. For example, nested parentheses are implied in the structure of the tree and are not presented in the form of nodes; and conditional jump statements such as if-condition-then can be represented using nodes with two branches.

[0051] The embodiment of the present application provides a flow code debugging method, referring to Figure 1 The flow code debugging method of the embodiment of the present application includes but is not limited to step S110, step S120, step S130, step S140 and step S150.

[0052] Step S110, parsing the flow code to be debugged through an abstract syntax analyzer to obtain component code;

[0053] Step S120, traversing the component code and converting the component code into a plurality of generators to obtain a generator tree;

[0054] Step S130, obtaining a debugging instruction and determining a first generator tree to be debugged and a start node according to the debugging instruction;

[0055] Step S140, starting and traversing the first generator tree to be debugged;

[0056] Step S150, when the start node is traversed, obtaining and loading context information of a previous run on the first generator tree, and running the code corresponding to the generator where the start node is located.

[0057] The flow code debugging method of the embodiment can be applied to a terminal, a server, software running in the terminal or the server, etc. The terminal can be a tablet computer, a notebook computer, a desktop computer, etc., but is not limited thereto. The server can be a standalone physical server, a server cluster or a distributed system composed of multiple physical servers, a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN, and big data and artificial intelligence platform, etc. The software program implementing the flow code debugging method includes a front-end interactive interface and a back-end debugging processing server. The front-end interactive interface is used to obtain the flow code input by a user, mark a breakpoint position, and obtain a user instruction. The back-end debugging processing server processes and runs the flow code based on the obtained breakpoint position, user instruction, etc., and feeds back a running debugging result to the front-end interactive interface.

[0058] In the embodiment, with reference to Figure 2 , the front-end interactive interface provides a plurality of flow code components. A user selects flow code components as needed, combines them, fills in appropriate parameters in the dashed box, and obtains the flow code.

[0059] In the embodiment, the flow code to be debugged is converted into a generator tree by an abstract syntax analyzer. The flow code is debugged based on the generator tree. After obtaining a debugging instruction, the first generator tree to be debugged and a start node (i.e., a specified arbitrary breakpoint position) are determined according to the debugging instruction. The first generator tree to be debugged is started and traversed. When the start node is reached, the context information of the last run of the first generator tree is obtained and loaded. The code corresponding to the generator where the start node is located is run. The running starts from the generator where the start node is located. It is not necessary to run from the beginning after modifying the code, thereby reducing the flow code debugging time.

[0060] According to some embodiments of the present application, the step of obtaining component code by parsing the flow code to be debugged by an abstract syntax analyzer in step S110 includes but is not limited to the following steps:

[0061] In step S210, the abstract syntax analyzer extracts key information and parameters in the flow code.

[0062] In step S220, the key information and parameters are assembled and format-converted to obtain component code.

[0063] In the embodiment, in the process of debugging the flow code, the backend debugging processing server reads the flow code to be debugged through the built-in abstract syntax analyzer (ast module). The ast (abstract syntax tree) is a tree representation of the abstract syntax structure of the source code. Each node on the tree represents a structure in the source code. Languages such as python / javascript are parsed and run through the ast module first. The backend debugging processing server of the embodiment parses the flow code through the ast module for the first time, such as identifying conditional branches, loop components and the like through key information in the flow code. Then, all condition parameters of the conditional branches and loop condition parameters of the loop components are extracted. The key information and the parameters are assembled and converted into the required json format, to obtain the component code, as shown in the following formula (1). Figure 3

[0064] According to some embodiments of the application, in step S120, the step of traversing the component code and converting the component code into a plurality of generators to obtain a generator tree includes but is not limited to the following steps:

[0065] In step S310, the component code is traversed and it is determined that the current code belongs to a unit type.

[0066] In step S320, a generator corresponding to the unit type is generated according to the unit type, and a corresponding traversal logic is executed according to the unit type.

[0067] In step S330, the superior-inferior relationship between the generators is determined according to the traversal logic.

[0068] In step S340, the generator tree is determined according to the superior-inferior relationship between the generators.

[0069] In the embodiment, the unit types include normal components, loop containers, exception capture containers, judgment branch containers, custom code blocks and sub-flow calling components. Correspondingly, the generators include basic generators, loop generators, exception capture generators, conditional judgment generators, automatic code block generators and sub-flow calling generators. If the unit type to which the current code belongs is a normal component, a basic generator is generated. If the unit type to which the current code belongs is a loop container, a loop generator is generated. If the unit type to which the current code belongs is an exception capture container, an exception capture generator is generated. If the unit type to which the current code belongs is a loop container, a loop generator is generated. If the unit type to which the current code belongs is a judgment branch container, a conditional judgment generator is generated. If the unit type to which the current code belongs is a custom code block, an automatic code block generator is generated. If the unit type to which the current code belongs is a sub-flow calling component, a sub-flow calling generator is generated. Figure 3 The loop generator corresponding to the component code of the loop container type shown in the following formula (2)​Figure 4 As shown.

[0070] In the embodiment, the traversal logic includes first traversal logic and second traversal logic, the first traversal logic is to traverse the next group of code units outside the current code unit, and the second traversal logic is to traverse the code in the current generator. If the first traversal logic is adopted, the currently generated generator and the next generated generator are sibling nodes, and if the second traversal logic is adopted, the currently generated generator is the parent node of the next generated generator.

[0071] Specifically, if the unit type to which the currently traversed code unit belongs is a normal component, the corresponding basic generator is converted, and then the first traversal logic is executed, that is, the next group of code units outside the basic group is traversed;

[0072] If the unit type to which the currently traversed code unit belongs is a loop container, a loop generator is generated, and then the second traversal logic is executed, that is, the corresponding code in the loop container is traversed, and the generator of the corresponding type is continuously generated, until the first traversal logic is executed after the loop container is traversed, that is, the next group of code units outside the loop container is traversed;

[0073] If the unit type to which the currently traversed code unit belongs is an exception capture container, an exception capture generator is generated, and then the second traversal logic is executed, that is, the corresponding code in the exception capture container is traversed, and the generator of the corresponding type is continuously generated, until the first traversal logic is executed after the exception capture container is traversed, that is, the next group of code units outside the exception capture container is traversed;

[0074] If the unit type to which the currently traversed code unit belongs is a judgment branch container, a conditional judgment generator is generated, and then the second traversal logic is executed, that is, the corresponding code in the judgment branch container is traversed, and the generator of the corresponding type is continuously generated, until the first traversal logic is executed after the judgment branch container is traversed, that is, the next group of code units outside the judgment branch container is traversed;

[0075] If the unit type to which the currently traversed code unit belongs is a custom code block, a custom code block generator is generated, and then the second traversal logic is executed, that is, the corresponding code in the custom code block is traversed, and the generator of the corresponding type is continuously generated, until the first traversal logic is executed after the custom code block is traversed, that is, the next group of code units outside the custom code block is traversed;

[0076] If the unit type to which the currently traversed code unit belongs is a sub-process calling component, a sub-process calling generator is generated, and then the second traversal logic is executed, that is, the corresponding code in the sub-process is traversed, and the generator of the corresponding type is continuously generated, until the first traversal logic is executed after the sub-process is traversed, that is, the next group of code units outside the sub-process is traversed;

[0077] As shown in the flow code on the front-end interactive interface, after being converted into component code by the abstract syntax analyzer, the flow code is traversed to obtain a generator tree as shown in Figure 2 Figure 5

[0078] According to some embodiments of the present application, the flow code debugging method of the embodiments of the present application further includes but is not limited to the following steps:

[0079] In step S410, in response to the debugging instruction, the second generator tree currently being iterated is closed, and the current context information of the second generator tree is saved.

[0080] In the present embodiment, the debugging instruction includes the first generator tree required to be debugged by the user. If the second generator tree currently being iterated is the same as the first generator tree in the debugging instruction, the current generator tree is directly debugged. If the second generator tree currently being iterated is not the same as the first generator tree in the debugging instruction, the second generator tree currently being iterated is closed, and the current context information of the second generator tree is saved for the next time to continue running the debugging, and then the first generator tree is started to begin the debugging. During the debugging, if the start node is not specified in the debugging instruction, the back-end debugging processing server starts the main iterator to begin running. If the start node is specified in the debugging instruction, the generator at the start node is started to run. When running to the breakpoint position marked by the user, the entire generator tree is paused to iterate and suspend the flow of the debugging, and the back-end debugging processing server enters a state of waiting for the front-end interactive information. When receiving the message from the front-end interactive interface, the back-end debugging processing server operates the generator tree according to different message types. For example, if the continue / next step instruction is received, the back-end debugging processing server drives the generator to continue running from the last suspended place, until the next breakpoint position is reached to suspend again, and enters the state of waiting for the front-end interactive information. If the flow code addition / deletion / modification operation message is received, the back-end debugging processing server directly modifies the structure and attributes of the current generator, and the modification takes effect immediately.

[0081] According to some embodiments of the present application, in step S140, the step of starting and traversing the first generator tree to be debugged includes but is not limited to the following steps:

[0082] In step S510, the node level mapping table of the first generator tree is searched according to the start node, and the level structure corresponding to the start node is determined.

[0083] In step S520, the first generator tree is started and traversed according to the level structure.

[0084] ​​In the embodiment, in the process of traversing the flow code and generating the generator tree, a node hierarchical relationship mapping table of the generator tree is generated simultaneously, and the node hierarchical relationship mapping table is used to represent the child generator of each generator and the breakpoint information contained in each generator. By querying the node hierarchical relationship mapping table, the hierarchical structure corresponding to the start node can be determined. For example, the start node is located in the base generator C, the base generator C is located in the loop generator B, and the loop generator B is located in the generator tree A, so the hierarchical structure of the start node is [A--B--C].

[0085] The back-end debugging processing server starts the first generator tree and begins iteration. At this time, the component code corresponding to the generator tree is not executed from the beginning, but the current iteration node is compared with the hierarchical structure by traversing the generator tree until the current node is the start node. Then, the context information saved by the last debugging and running of the first generator tree is loaded into the context of the current running, and the component code corresponding to the generator (for example, the base generator C) in which the start node is located is run.

[0086] On the other hand, the embodiment of the present application also provides a flow code debugging system, comprising:

[0087] A first module is configured to parse the flow code to be debugged by an abstract syntax analyzer to obtain component code;

[0088] A second module is configured to traverse the component code and convert the component code into a plurality of generators to obtain a generator tree;

[0089] A third module is configured to obtain a debugging instruction and determine the first generator tree to be debugged and the start node according to the debugging instruction;

[0090] A fourth module is configured to start and traverse the first generator tree to be debugged;

[0091] A fifth module is configured to, when the start node is reached, obtain and load the context information of the last running of the first generator tree, and run the code corresponding to the generator in which the start node is located.

[0092] It can be understood that the contents in the flow code debugging method embodiment are applicable to the system embodiment, the system embodiment specifically implements the same functions as the flow code debugging method embodiment, and achieves the same beneficial effects as the flow code debugging method embodiment.

[0093] Reference Figure 6 , Figure 6is a schematic diagram of a flow code debugging apparatus provided by an embodiment of the present application. The flow code debugging apparatus of the embodiment of the present application comprises one or more control processors and a memory, Figure 6 The control processor and the memory are taken as an example in the embodiment of the present application.

[0094] The control processor and the memory can be connected through a bus or other means, Figure 6 The connection through the bus is taken as an example in the embodiment of the present application.

[0095] The memory, as a kind of non-transient computer readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory can include a high-speed random access memory, and can also include a non-transient memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transient solid-state memory device. In some embodiments, the memory can optionally include a memory remotely arranged relative to the control processor, and these remote memories can be connected to the flow code debugging apparatus through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0096] Those skilled in the art can understand that, Figure 6 The apparatus structure shown in the embodiment of the present application does not constitute a limitation on the flow code debugging apparatus, and can include more or fewer components than those shown in the figure, or combine certain components, or different component arrangements.

[0097] The non-transient software programs and instructions required to implement the flow code debugging method applied to the flow code debugging apparatus in the above embodiment are stored in the memory, and when executed by the control processor, the flow code debugging method applied to the flow code debugging apparatus in the above embodiment is executed.

[0098] In addition, an embodiment of the present application further provides a computer readable storage medium, which stores computer executable instructions, and the computer executable instructions are executed by one or more control processors, so that the one or more control processors execute the flow code debugging method in the above method embodiment.

[0099] As will be appreciated by one of ordinary skill in the art, all or some of the steps, systems, and techniques disclosed herein can be embodied in software, firmware, hardware, or any suitable combination thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application- specific integrated circuit. Such software can be distributed on computer readable media, which can comprise computer storage media (or non-transitory media), and communication media (or transitory media). As will be appreciated by one of ordinary skill in the art, the term computer storage media includes all physical and tangible computer storage media, such as a volatile and non-volatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by a computer. Further, as will be appreciated by one skilled in the art, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media.

[0100] The embodiments of the present application disclosed above are only used to explain the principle of the present application, but the present application is not limited to the above embodiments. Various changes can be made by those skilled in the art without departing from the spirit of the present application.

Claims

1. A method for debugging process code, characterized in that, Includes the following steps: The component code is obtained by parsing the process code to be debugged using an abstract syntax analyzer. Traverse the component code and convert it into multiple generators to obtain a generator tree; The generator is a function that uses yield in Python; Obtain debugging instructions and determine the first generator tree and start node to be debugged based on the debugging instructions; Start and traverse the first generator tree to be debugged; When the starting node is reached, the context information of the previous run of the first generator tree is obtained and loaded, and the code corresponding to the generator where the starting node is located is run. The process of traversing the component code and converting it into multiple generators to obtain a generator tree includes the following steps: Traverse the component code and determine the unit type to which the current code unit belongs; Generate a generator corresponding to the unit type according to the unit type and execute the corresponding traversal logic according to the unit type; The hierarchical relationship between the generators is determined based on the traversal logic. The generator tree is determined based on the hierarchical relationship between the generators.

2. The process code debugging method according to claim 1, characterized in that, The process of parsing the code to be debugged using an abstract syntax analyzer to obtain the component code includes the following steps: The abstract syntax analyzer extracts key information and parameters from the process code. The key information and parameters are assembled and their format converted to obtain the component code.

3. The process code debugging method according to claim 1, characterized in that, The unit types include ordinary components, loop containers, exception handling containers, conditional branch containers, custom code blocks, and sub-process call components. The generators include basic generators, loop generators, exception handling generators, conditional generators, automatic code block generators, and sub-process call generators.

4. The process code debugging method according to claim 3, characterized in that, The traversal logic includes a first traversal logic and a second traversal logic. The first traversal logic is to traverse the next group of code units outside the current code unit, and the second traversal logic is to traverse the code within the current code unit. If the current code unit belongs to a unit type of ordinary component, then generate the basic generator and execute the first traversal logic; If the current code unit belongs to one of the following unit types: loop container, exception handling container, conditional branch container, custom code block, or sub-process call component, then the corresponding generator is generated and the second traversal logic is executed.

5. The process code debugging method according to claim 1, characterized in that, The process code debugging method also includes the following steps: In response to the debugging instruction, the currently iterating second generator tree is closed, and the current context information of the second generator tree is saved.

6. The process code debugging method according to claim 1, characterized in that, The process of initiating and traversing the first generator tree to be debugged includes the following steps: The node hierarchy mapping table of the first generator tree is searched based on the starting node to determine the hierarchical structure corresponding to the starting node; Initiate and traverse the first generator tree according to the hierarchical structure.

7. A process code debugging system, characterized in that, include: The first module is used to parse the process code to be debugged using an abstract syntax analyzer to obtain the component code; The second module is used to traverse the component code and convert the component code into multiple generators to obtain a generator tree; The generator is a function that uses yield in Python; The third module is used to obtain debugging instructions and determine the first generator tree and the start node to be debugged based on the debugging instructions; The fourth module is used to start and traverse the first generator tree to be debugged; The fifth module is used to obtain and load the context information of the previous run of the first generator tree when the starting node is traversed, and to run the code corresponding to the generator where the starting node is located; The second module is specifically used to perform the following steps: The process of traversing the component code and converting it into multiple generators to obtain a generator tree includes the following steps: Traverse the component code and determine the unit type to which the current code unit belongs; Generate a generator corresponding to the unit type according to the unit type and execute the corresponding traversal logic according to the unit type; The hierarchical relationship between the generators is determined based on the traversal logic. The generator tree is determined based on the hierarchical relationship between the generators.

8. A flowchart debugging device, characterized in that, include: At least one processor; At least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the flow code debugging method as described in any one of claims 1 to 6.

9. A computer-readable storage medium storing a processor-executable program, characterized in that, When the processor executes the program, it is used to implement the flow code debugging method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Transforming user script code for debugging

    CN102246150A

  • Visual debugging method and debugging system for robot automation process

    CN112860362A