CN114461198A - Program generation method, device, equipment and medium based on visual low code - Google Patents

Program generation method, device, equipment and medium based on visual low code Download PDF

Info

Publication number
CN114461198A
CN114461198A CN202111614439.XA CN202111614439A CN114461198A CN 114461198 A CN114461198 A CN 114461198A CN 202111614439 A CN202111614439 A CN 202111614439A CN 114461198 A CN114461198 A CN 114461198A
Authority
CN
China
Prior art keywords
edge
node
edges
nodes
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111614439.XA
Other languages
Chinese (zh)
Other versions
CN114461198B (en
Inventor
梁靖
唐瑞伯
叶倩雯
李林颖
颜勇
周莉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Research Institute Of Shanghai Jiaotong University
Original Assignee
Sichuan Research Institute Of Shanghai Jiaotong University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Research Institute Of Shanghai Jiaotong University filed Critical Sichuan Research Institute Of Shanghai Jiaotong University
Priority to CN202111614439.XA priority Critical patent/CN114461198B/en
Publication of CN114461198A publication Critical patent/CN114461198A/en
Application granted granted Critical
Publication of CN114461198B publication Critical patent/CN114461198B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Stored Programmes (AREA)
  • Image Generation (AREA)

Abstract

The invention discloses a program generating method, a device, equipment and a medium based on visual low codes, wherein the method comprises the steps of acquiring and loading flow chart data, wherein the flow chart data comprises nodes and edges of a flow chart, the edges comprise an IN edge and an OUT edge, the OUT edge represents the edge of the node, and the IN edge represents the edge of the node; determining the order of the OUT edges of a node by repeatedly traversing the subgraph behind the node; determining the sequence of control nodes and edges of the nodes by repeating depth traversal, and judging the types of the edges, wherein the control nodes are nodes necessary for reaching a certain node; adjusting the edge type according to the control relation between the nodes, and determining the only edge of each node from the control node; determining code types of the code blocks, the nesting layers and the edges, generating a program code, and generating an application program according to the program code. The present invention is able to generate programs with relatively complex logic by sequencing nodes and edges.

Description

Program generation method, device, equipment and medium based on visual low code
Technical Field
The invention belongs to the technical field of low-code programming, and particularly relates to a program generation method, a device, equipment and a medium based on visual low-code.
Background
The low-code development is an application development method, and the low-code development platform is a development platform which can quickly build an application system without coding or using a small amount of codes. Through low-code development, developers can create Web and mobile applications through a graphical user interface using drag-and-drop components and model driven logic.
In recent years, the development of visualization low-code programming support is rapid, and the core of the development is an algorithm for generating code by configuring a graph generated by a visualization tool. At present, the method is mainly used for MIS software with low algorithm flexibility requirements, and the configuration contents mainly comprise processes of business processing, data analysis and the like.
The current tools and platforms have the problems of low flexibility, learning and training and the like. The general flow chart used by the existing low-code development platform belongs to a directed unordered graph, the basic algorithm of the graph is commonly seen in the courses of a data structure and an algorithm, and the problem of unordered codes is solved by writing the graph with single code blocks with an inlet and an outlet. Thus, low code programming is limited to logically simpler processes such as managing business processes. And the method has higher requirements on algorithm flexibility, such as the solution of the CFD problem of the large-scale parallel computing, and has no support.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a program generation method, a device, equipment and a medium based on visual low code, and a program with relatively complex logic can be generated by sequencing nodes and edges.
The purpose of the invention is realized by the following technical scheme:
a method for visually low-code based program generation, the method comprising:
acquiring and loading flow chart data, wherein the flow chart data comprises nodes and edges of a flow chart, the edges comprise an IN edge and an OUT edge, the OUT edge represents the edge of the node, and the IN edge represents the edge of the node;
determining the order of the OUT edges of a node by repeatedly traversing the subgraph behind the node;
determining the sequence of control nodes and edges of the nodes by repeating depth traversal, and judging the types of the edges, wherein the control nodes are nodes necessary for reaching a certain node;
adjusting the edge type according to the control relation between the nodes, and determining the only edge of each node from the control node;
determining code types of the code blocks, the nesting layers and the edges, generating a program code, and generating an application program according to the program code.
Further, the determining the order of the OUT edges of the nodes specifically includes:
if the OUT edge of the node is an unconditional edge, executing the operation finally;
and if the OUT edges of the nodes are conditional edges, determining the sequence of the OUT edges of the nodes according to the difference between the abscissa and the ordinate of the subsequent nodes.
Further, the determining the order of the OUT edges of the nodes according to the difference between the abscissa and the ordinate of the subsequent node specifically includes:
counting the accumulated value of the horizontal and vertical coordinate differences of the subsequent node, if the accumulated value of the horizontal coordinate differences is larger than the accumulated value of the vertical coordinate differences, determining the sequence of the OUT edges by the horizontal coordinate of the subsequent node, otherwise, determining the sequence of the OUT edges by the vertical coordinate;
or comparing the horizontal and vertical coordinate difference values between each successive node, if the number of times that the horizontal coordinate difference value is larger than the vertical coordinate difference value, determining the OUT side sequence by the horizontal coordinate, otherwise, determining the OUT side sequence by the vertical coordinate.
Further, the determining the sequence of the control node and the edge of the node by repeating the depth traversal, and the determining the type of the edge specifically includes:
calculating a control set of each node by repeatedly traversing the subgraph of each node in depth, and distributing a sequence to each node, wherein the sequence is the traversal step number when each node is reached;
determining whether each edge of the node is a forward edge, a return edge, or an intersecting edge, the forward edge being an edge that arrives from the control node, the return edge being an edge that arrives at the control node, the intersecting edge being a third edge different from the forward edge and the return edge;
the repeated depth traversal follows the following rules:
traversing the forward edge forward depth;
the returning edge does not carry out depth traversal;
and for the crossed edge, firstly traversing the type of the rear edge, if the front edge exists, continuing to traverse along the front edge, if the front edge does not exist, continuing to traverse along the crossed edge reaching the maximum sequence delay end point, and changing the type of the crossed edge reaching the maximum sequence delay end point into the front edge.
Further, the calculating the control set of each node specifically includes:
the control set of the starting node is the starting node itself at the beginning, and the control sets of other nodes are empty;
when the starting point s reaches the end point t, if the control set of the end point t is empty, then dom (t) ═ tuc dom(s), otherwise, dom (t) ═ dom (t) · d (s)) is not used.
Further, the adjusting the edge type according to the control relationship between the nodes and determining the only edge of each node arriving from the control node specifically includes:
if a certain node has a plurality of forwarding edges, the forwarding edges except the forwarding edge with the largest sequence number keep the original type, and the other forwarding edges all adjust the type to be a cross edge.
Further, the determining the code types of the code blocks, the nesting layers and the edges, and the generating the program code specifically includes:
marking the cyclic code blocks;
marking edges in the circulation;
marking branch code blocks;
classifying and marking nesting levels of the code blocks;
program code is generated.
In another aspect, the present invention further provides a program generating apparatus based on visual low-code, the apparatus including:
the data loading module is used for acquiring and loading flow chart data, wherein the flow chart data comprises nodes and edges of a flow chart, the edges comprise an IN edge and an OUT edge, the OUT edge represents the edge of the node, and the IN edge represents the edge of the node;
the OUT edge sorting module is used for determining the order of the OUT edges of the nodes by repeatedly traversing the subgraph behind a certain node;
the node sequencing module is used for determining the sequence of control nodes and edges of the nodes through repeated depth traversal and judging the types of the edges, wherein the control nodes are nodes necessary for reaching a certain node;
the edge type adjusting module is used for adjusting the edge type according to the control relation among the nodes and determining the only edge of each node which arrives from the control node;
and the program generation module is used for determining the code types of the code blocks, the nesting layers and the edges, generating a program code and generating an application program according to the program code.
Optionally, the determining, by the OUT edge sorting module, the order of the OUT edges of the nodes specifically includes:
if the OUT edge of the node is an unconditional edge, executing the operation finally;
and if the OUT edges of the nodes are conditional edges, determining the sequence of the OUT edges of the nodes according to the difference between the abscissa and the ordinate of the subsequent nodes.
Optionally, the determining, by the OUT edge sorting module, the order of the OUT edges of the nodes according to the difference between the abscissa and the ordinate of the subsequent node specifically includes:
counting the accumulated value of the horizontal and vertical coordinate differences of the subsequent node, if the accumulated value of the horizontal coordinate differences is larger than the accumulated value of the vertical coordinate differences, determining the sequence of the OUT edges by the horizontal coordinate of the subsequent node, otherwise, determining the sequence of the OUT edges by the vertical coordinate;
or comparing the horizontal and vertical coordinate difference values between each successive node, if the number of times that the horizontal coordinate difference value is larger than the vertical coordinate difference value, determining the OUT side sequence by the horizontal coordinate, otherwise, determining the OUT side sequence by the vertical coordinate.
Optionally, the node sequencing module determines the order of the control node and the edge of the node by repeating the depth traversal, and determining the type of the edge specifically includes:
calculating a control set of each node by repeatedly and deeply traversing the subgraph behind each node, and distributing a sequence to each node, wherein the sequence is the traversal step number when each node is reached;
determining whether each edge of the node is a forward edge, a return edge, or an intersecting edge, the forward edge being an edge that arrives from the control node, the return edge being an edge that arrives at the control node, the intersecting edge being a third edge different from the forward edge and the return edge;
the repeated depth traversal follows the following rules:
traversing the forward edge forward depth;
the returning edge does not carry out depth traversal;
and for the crossed edge, firstly traversing the type of the rear edge, if the front edge exists, continuing to traverse along the front edge, if the front edge does not exist, continuing to traverse along the crossed edge reaching the maximum sequence delay end point, and changing the type of the crossed edge reaching the maximum sequence delay end point into the front edge.
Optionally, the calculating, by the node sequencing module, the control set of each node specifically includes:
the control set of the starting node is the starting node itself at the beginning, and the control sets of other nodes are empty;
when the starting point s reaches the end point t, if the control set of the end point t is empty, then dom (t) ═ tuc dom(s), otherwise, dom (t) ═ dom (t) · d (s)) is not used.
Optionally, the edge type adjusting module adjusts the edge type according to the control relationship between the nodes, and determining an edge that each node uniquely reaches from the control node specifically includes:
if a certain node has a plurality of forwarding edges, the forwarding edges except the forwarding edge with the largest sequence number keep the original type, and the other forwarding edges all adjust the type to be a cross edge.
Optionally, the program generation module determines the code types of the code block, the nesting level, and the edge, and generating the program code specifically includes:
marking the cyclic code blocks;
marking edges in the circulation;
marking branch code blocks;
classifying and marking nesting levels of the code blocks;
program code is generated.
In another aspect, the present invention further provides a computer device, which includes a processor and a memory, where the memory stores a computer program, and the computer program is loaded by the processor and executed to implement any one of the above-mentioned visual low-code-based program generation methods.
In another aspect, the present invention further provides a computer-readable storage medium, in which a computer program is stored, and the computer program is loaded and executed by a processor to implement any one of the above-mentioned visualization low-code based program generation methods.
The invention has the beneficial effects that:
(1) the visualized low-code-based program generation method, the visualized low-code-based program generation device, the visualized low-code-based program generation equipment and the visualized low-code-based program generation medium determine the arrangement sequence of nodes and edges in the general directed unordered flow chart through analysis, so that the multi-exit flow chart can be used for low-code programming, and a program with complex logic is generated.
(2) The method, the device, the equipment and the medium for generating the program based on the visual low code can solve the problem that the traditional low code programming scheme can not support unstructured programming.
Drawings
FIG. 1 is a flow chart of a visualization-based low-code program generation method provided by an embodiment of the invention;
fig. 2 is a schematic diagram of a repeated depth traversal process provided by an embodiment of the present invention, in which fig. 2(a) is an original diagram, fig. 2(b) is a schematic diagram of a first round of traversal, fig. 2(c) is a schematic diagram of a second round of traversal, and fig. 2(d) is a final diagram;
fig. 3 is a block diagram of a program generation apparatus based on visual low-code according to an embodiment of the present invention.
Detailed Description
The embodiments of the present invention are described below with reference to specific embodiments, and other advantages and effects of the present invention will be easily understood by those skilled in the art from the disclosure of the present specification. The invention is capable of other and different embodiments and of being practiced or of being carried out in various ways, and its several details are capable of modification in various respects, all without departing from the spirit and scope of the present invention. It is to be noted that the features in the following embodiments and examples may be combined with each other without conflict.
All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The current tools and platforms have the problems of low flexibility, learning and training and the like. The general flow chart used by the existing low-code development platform belongs to a directed unordered graph, the basic algorithm of the graph is commonly seen in the courses of a data structure and an algorithm, and the problem of unordered codes is solved by writing the graph with single code blocks with an inlet and an outlet. Thus, low code programming is limited to logically simpler processes such as managing business processes. And the method has higher requirements on algorithm flexibility, such as the solution of the CFD problem of the large-scale parallel computing, and has no support.
In order to solve the above technical problems, the following embodiments of the visualized low-code based program generation method, device, apparatus and medium of the present invention are proposed.
Example 1
Referring to fig. 1, as shown in fig. 1, a flowchart of a program generation method based on visualized low code provided by this embodiment is illustrated. The method specifically comprises the following steps:
step S100: and acquiring and loading flow chart data, wherein the flow chart data comprises nodes and edges of the flow chart, the edges comprise an IN edge and an OUT edge, the OUT edge represents the edge of the node, and the IN edge represents the edge of the node. This step loads the nodes, edges, etc. information of the flow diagram and prepares the data structure for analysis.
Step S200: the order of the OUT edges of the nodes is determined by repeatedly traversing the subgraph after a certain node. For a branch node, there will be multiple OUT edges. Since addition and deletion adjustments are made during plotting, it is necessary to make an effective rule to determine the order of OUT edges. The OUT edges of the nodes have different sequences and different codes (i.e. ambiguity exists), and the order of the OUT edges needs to be determined by a reasonable arbitration rule.
As an implementation manner, the determining the order of the OUT edges of the nodes in this embodiment specifically includes:
if the OUT edge of the node is an unconditional edge, executing the operation finally; the unconditional edge is a condition when entering the next node, and the unconditional edge is always executed last, because if the unconditional edge is executed before, the subsequent branches are executed without chance, and the unconditional edge is similar to a dummy edge.
And if the OUT edges of the nodes are conditional edges, determining the order of the OUT edges of the nodes according to the difference between the abscissa and the ordinate of the subsequent nodes.
Wherein, the determining the order of the OUT edges of the nodes according to the difference between the abscissa and the ordinate of the succeeding node specifically comprises:
the method comprises the following steps: and counting the accumulated value of the horizontal and vertical coordinate differences of the subsequent node, if the accumulated value of the horizontal coordinate differences is larger than the accumulated value of the vertical coordinate differences, determining the sequence of the OUT edges by the horizontal coordinate of the subsequent node, and otherwise, determining the sequence of the OUT edges by the vertical coordinate. And sequentially counting the accumulated values of the horizontal and vertical coordinate differences, for example, summing the differences of median of the horizontal and vertical coordinates, and taking the larger one as the main, so that the judgment is simpler. If a jump edge is encountered, adjustment is carried out after global analysis. The method of global analysis belongs to the conventional technical means for those skilled in the art, and is not described herein in detail.
The method 2 comprises the following steps: and comparing the horizontal and vertical coordinate difference values between each successive node, if the number of times that the horizontal coordinate difference value is larger than the vertical coordinate difference value, determining the OUT side sequence by using the horizontal coordinate, otherwise, determining the OUT side sequence by using the vertical coordinate. For example: 5 OUT sides reach 5 end points, the horizontal and vertical differences between the 1 st point and the 2 nd point are calculated, if the horizontal difference value is large, namely the horizontal difference is +1, then the vertical differences between 1 and 3 are calculated, if the vertical difference is large, the vertical difference is +1, and the 1 and 4 are compared until 4 and 5 are obtained, and the total number of the horizontal and vertical differences is obtained, and if the horizontal difference is large, the horizontal coordinate is judged to be dominant.
Further, in addition to the above two methods, the OUT edge order may be set manually.
It should be noted that, in the present embodiment, the determining of the order of the OUT edges by the abscissa or the determining of the order of the OUT edges by the ordinate means that the order is from left to right when the order of the OUT edges is determined by the abscissa and from top to bottom when the order of the OUT edges is determined by the ordinate according to the drawing habit, but according to the operation habit of different developers, the order may also be from right to left when the order of the OUT edges is determined by the abscissa and from bottom to top when the order of the OUT edges is determined by the ordinate.
By the method for determining the order of the OUT edges of the nodes provided by the embodiment, a reasonable execution order can be formed for the OUT edges of each branch node.
Step S300: and determining the sequence of the control node and the edge of the node by repeating the depth traversal, and judging the type of the edge, wherein the control node is a node necessary for reaching a certain node. The nodes and edges are uniformly numbered, and the number is the position sequentially appearing in the object code.
In this embodiment, a depth traversal is used to calculate a dom (control) set of each node, and if there is a dom set of each node, the control relationship between the nodes is known, so as to find out a dependent set of the nodes. Distinguish the advancing edge (side a), the returning edge (side B), the crossing edge (side C): if the starting point of the side is the dom point of the end point, the side is A, if the end point is the dom point of the starting point, the side is B, otherwise, the side is C. In addition, it is also necessary to ensure that the end of the A-edge is necessarily the successor code node.
Wherein, calculating the control set of each node specifically comprises:
the control set of the starting node is the starting node itself at the beginning, and the control sets of other nodes are empty;
when the starting point s reaches the end point t, if the control set of the end point t is empty, then dom (t) ═ tuc dom(s), otherwise, dom (t) ═ dom (t) · d (s)) is not used.
The depth traversal is repeated, the traversed sub-graph needs to be continued, and for an edge reaching the same node (for example, an exit point of an if code block), the sub-graph after the exit of the node (a code block after the if block) needs to be repeated, otherwise, the order of the sub-graph node is smaller than that of its predecessor node (a branch in the if block, which is reached later).
The assignment sequence of the nodes is marked according to the traversal sequence, namely the current step number of traversal, the continuity is not guaranteed in the process of assigning the sequence to the nodes, the increase is ensured, and the sequence is finally arranged into the continuity sequence.
As an implementation manner, the present embodiment determines the order of the control node and the edge of the node by repeating the depth traversal, and determining the type of the edge specifically includes:
calculating a control set of each node by repeatedly traversing the subgraph of each node in depth, and distributing a sequence to each node, wherein the sequence is the traversal step number when each node is reached;
judging whether each edge of the node is a forward edge, a return edge or a cross edge, wherein the forward edge is an edge which is reached from the control node, the return edge is an edge which is reached to the control node, and the cross edge is a third edge which is different from the forward edge and the return edge;
the repeated depth traversal follows the following rules:
traversing the forward edge forward depth;
the returning edge does not carry out depth traversal;
and for the crossed edge, traversing the type of the rear edge, if the front edge exists, continuing to traverse along the front edge, if the front edge does not exist, continuing to traverse along the crossed edge reaching the maximum sequence delay end point, and changing the type of the crossed edge reaching the maximum sequence delay end point into the front edge.
Referring to fig. 2, fig. 2 is a schematic diagram illustrating a repeated depth traversal process provided in this embodiment.
Fig. 2(a) is an original diagram, in the present embodiment, traversal is performed in the order of from left to right of OUT side and from top to bottom, from the step of (i) to (ii), depth-first traversal is performed until completion, nodes are numbered 1 to 7 along the way, and a diagram (2) b is a first round of traversal diagram; then returning to the branch node 6, and not going because the edge is the C edge; and the eighth step returns to the branch node 5, and the branch node is not traversed continuously because the branch node is the side B, and returns to the last branch node with the branch which is not traversed continuously. And going back to the branch node 2 (i.e. the last branch node with branches which have not been traversed) to traverse downwards, numbering from 8 to 11 to obtain a node number 8-11, and obtaining a diagram (c) in fig. 2, wherein the diagram (c) in the second round of traversal is shown. The method provided in the following embodiment will also return to node 10/9, but the sequence number is not changed. Finally, after sorting, successive numbers are given to obtain a final graph, and fig. 2(d) is the final graph.
And simultaneously, determining the order of edges, wherein the method is similar to that of the nodes, and when the node arrives, a sequence number is given, the node is repeatedly numbered, and finally the sequence number is arranged into a continuous number. The nodes and edges can be numbered uniformly, because the codes generate the edges when the codes generate the codes of the nodes, and the edges are generated in the same order as the traversal.
Step S400: and adjusting the edge type according to the control relation among the nodes, and determining the edge which is uniquely reached from the control node by each node.
Specifically, adjusting the edge type according to the control relationship between the nodes, and determining the edge that each node uniquely reaches from the control node includes:
if a certain node has a plurality of forwarding edges, the forwarding edges except the forwarding edge with the largest sequence number keep the original type, and the other forwarding edges all adjust the type to be a cross edge. The node IN edge has a plurality of A edges, except the largest serial number, all the A edges are changed into C edges. Since the latest predecessor code for each node can only be the previous line, the last one to arrive is its A edge, and the other A's are changed to C's. For example, IN edges of exit nodes of the if block, only else edges start with a edges, and the others are C edges.
In addition, it is necessary to check whether the flowchart has an error, that is, whether there is an isolated point or whether there is a line that cannot reach the end point.
Step S500: and determining code types of the code blocks, the nesting hierarchy and the edges, generating a program code, and generating an application program according to the program code.
Specifically, determining code types of the code blocks, the nesting levels and the edges, and generating the program code specifically includes:
firstly, a cyclic code block is marked, then an edge in the cycle is marked, and finally a branch code block is marked. And marking the label of the code block, namely marking the node of which the starting node and the exit arrive.
The nesting level of the marked code blocks is classified. Blocks can be nested, but on the premise of order, just like analyzing bracket nesting, only classification labels are needed. Nested inclusion, which is marked by stack structure in sequence.
In order and dom relationships, it is easy to distinguish between the code block characteristics of while/uniform/if, etc. Because the block has only a single ingress/egress, the ingress node is the control node for all nodes in the block, and the egress is the controlled node with the largest sequence number (e.g., the egress of the while block is the end point of the else edge of the start node). Then, the branch edges in the block are labeled with continue/break/goto characteristics, which are the edges reaching the entrance, the exit and the outside of the block respectively.
And finally, generating codes, namely marking the codes and corresponding target language templates according to the code types and generating corresponding statements.
The whole process is processed in five steps, the step S100 is necessary for loading preparation, and other steps are arranged for the following reasons:
a) before traversing the order of the analysis nodes (step 300), ambiguity of the execution order of the node OUT edges is resolved (step 2);
b) the edge type determination includes some non-simple local problems, so that the adjustment is performed (step S400) after the whole image is scanned (step S300);
c) after the sequential analysis of the node and the edge is completed (step S300 and step S400), the hierarchical code block formed by the node edge can be identified (step S500);
d) after the loop code block is identified (step S500), the code type (continue/break/goto) of the branch jump edge can be determined (step S500);
e) the final code can only be generated after the above work is completed.
The processing functions of these several processing steps are difficult to blend into a single complex algorithmic step, and thus multiple passes of analysis are necessary.
The visualized low-code-based program generating method provided by this embodiment determines, through analysis, an arrangement order of nodes and edges in a general directed chaotic flow chart, so that a multi-outlet flow chart can be used for low-code programming, and a program with a complex logic is generated.
Example 2
Referring to fig. 3, as shown in fig. 3, a structural block diagram of a program generating device based on visualized low code provided by the present embodiment is shown. The device specifically includes:
the data loading module 10 is configured to acquire and load flow chart data, where the flow chart data includes nodes and edges of a flow chart, the edges include an IN edge and an OUT edge, the OUT edge represents an edge of the node, and the IN edge represents an edge of the node;
an OUT edge sorting module 20, configured to determine an order of OUT edges of the nodes by repeatedly traversing a sub-graph after a certain node;
a node sequencing module 30, configured to determine the order of control nodes and edges of a node through repeated depth traversal, and determine the type of an edge, where a control node is a node that must pass through to reach a certain node;
an edge type adjusting module 40, configured to adjust an edge type according to a control relationship between nodes, and determine an edge that each node uniquely reaches from a control node;
and the program generation module 50 is used for determining the code types of the code blocks, the nesting layers and the edges, generating a program code and generating an application program according to the program code.
As an embodiment, the determining, by the OUT edge sorting module 20, the order of the OUT edges of the nodes specifically includes:
if the OUT edge of the node is an unconditional edge, executing the operation finally;
and if the OUT edges of the nodes are conditional edges, determining the order of the OUT edges of the nodes according to the difference between the abscissa and the ordinate of the subsequent nodes.
As an embodiment, the determining, by the OUT edge sorting module 20, the order of the OUT edges of the nodes according to the difference between the abscissa and the ordinate of the subsequent node specifically includes:
counting the accumulated value of the horizontal and vertical coordinate differences of the subsequent node, if the accumulated value of the horizontal coordinate differences is larger than the accumulated value of the vertical coordinate differences, determining the sequence of the OUT edges by the horizontal coordinate of the subsequent node, otherwise, determining the sequence of the OUT edges by the vertical coordinate;
or comparing the horizontal and vertical coordinate difference values between each successive node, if the number of times that the horizontal coordinate difference value is larger than the vertical coordinate difference value, determining the OUT side sequence by the horizontal coordinate, otherwise, determining the OUT side sequence by the vertical coordinate.
As an embodiment, the node sequencing module 30 determines the order of the control nodes and the edges of the nodes by repeating the depth traversal, and determining the type of the edge specifically includes:
calculating a control set of each node by repeatedly traversing the subgraph of each node in depth, and distributing a sequence to each node, wherein the sequence is the traversal step number when each node is reached;
judging whether each edge of the node is a forward edge, a return edge or a cross edge, wherein the forward edge is an edge which is reached from the control node, the return edge is an edge which is reached to the control node, and the cross edge is a third edge which is different from the forward edge and the return edge;
the repeated depth traversal follows the following rules:
traversing the forward edge forward depth;
the returning edge does not carry out depth traversal;
and for the crossed edge, traversing the type of the rear edge, if the front edge exists, continuing to traverse along the front edge, if the front edge does not exist, continuing to traverse along the crossed edge reaching the maximum sequence delay end point, and changing the type of the crossed edge reaching the maximum sequence delay end point into the front edge.
As an embodiment, the node sequencing module 30 calculates the control set of each node specifically includes:
the control set of the starting node is the starting node itself at the beginning, and the control sets of other nodes are empty;
when the starting point s reaches the end point t, if the control set of the end point t is empty, then dom (t) is no (t ═ u Dom (s)), otherwise, dom (t) is no (t ═ u Dom (s)).
As an embodiment, the edge type adjusting module 40 adjusts the edge type according to the control relationship between the nodes, and determining an edge uniquely reached by each node from the control node specifically includes:
if a certain node has a plurality of forwarding edges, the forwarding edges except the forwarding edge with the largest sequence number keep the original type, and the other forwarding edges all adjust the type to be a cross edge.
As an embodiment, the program generating module 50 determines the code types of the code blocks, the nesting levels, and the edges, and the generating the program code specifically includes:
marking the cyclic code blocks;
marking edges in the circulation;
marking branch code blocks;
classifying and marking nesting levels of the code blocks;
program code is generated.
The program generating device based on the visual low code provided by this embodiment determines the arrangement order of the nodes and the edges in the general directed chaotic flow chart through analysis, so that the multi-outlet flow chart can be used for low code programming to generate a program with a more complex logic.
Example 3
The preferred embodiment provides a computer device, which can implement the steps in any embodiment of the method for generating a program based on a visual low code provided in the embodiment of the present application, and therefore, the beneficial effects of the method for generating a program based on a visual low code provided in the embodiment of the present application can be achieved, which are detailed in the foregoing embodiments and will not be described herein again.
Example 4
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor. To this end, the present invention provides a storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps of any embodiment of the visual low-code-based program generation method provided by the present invention.
Wherein the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the instructions stored in the storage medium may execute the steps in any embodiment of the method for generating a program based on a visual low code provided in the embodiment of the present invention, beneficial effects that can be achieved by any method for generating a program based on a visual low code provided in the embodiment of the present invention may be achieved, for details, see the foregoing embodiment, and are not described herein again.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (10)

1. A method for visually generating a low-code based program, the method comprising:
acquiring and loading flow chart data, wherein the flow chart data comprises nodes and edges of a flow chart, the edges comprise an IN edge and an OUT edge, the OUT edge represents the edge of the node, and the IN edge represents the edge of the node;
determining the order of the OUT edges of a node by repeatedly traversing the subgraph behind the node;
determining the sequence of control nodes and edges of the nodes by repeating depth traversal, and judging the types of the edges, wherein the control nodes are nodes necessary for reaching a certain node;
adjusting the edge type according to the control relation between the nodes, and determining the edge which is uniquely reached by each node from the control node;
determining code types of the code blocks, the nesting layers and the edges, generating a program code, and generating an application program according to the program code.
2. The visualization-based low-code program generation method of claim 1, wherein the determining the order of the OUT edges of the nodes specifically comprises:
if the OUT edge of the node is an unconditional edge, executing the operation finally;
and if the OUT edges of the nodes are conditional edges, determining the sequence of the OUT edges of the nodes according to the difference between the abscissa and the ordinate of the subsequent nodes.
3. The visualization-based low-code program generation method of claim 2, wherein the determining the order of the OUT edges of the nodes according to the difference between the abscissa and the ordinate of the subsequent node specifically comprises:
counting the accumulated value of the horizontal and vertical coordinate differences of the subsequent node, if the accumulated value of the horizontal coordinate differences is larger than the accumulated value of the vertical coordinate differences, determining the sequence of the OUT edges by the horizontal coordinate of the subsequent node, otherwise, determining the sequence of the OUT edges by the vertical coordinate;
or comparing the horizontal and vertical coordinate difference values between each successive node, if the number of times that the horizontal coordinate difference value is larger than the vertical coordinate difference value, determining the OUT side sequence by the horizontal coordinate, otherwise, determining the OUT side sequence by the vertical coordinate.
4. The method of claim 1, wherein determining the order of the control nodes and edges of the nodes by repeating the depth traversal and determining the type of the edge specifically comprises:
calculating a control set of each node by repeatedly traversing the subgraph of each node in depth, and distributing a sequence to each node, wherein the sequence is the traversal step number when each node is reached;
determining whether each edge of the node is a forward edge, a return edge, or an intersecting edge, the forward edge being an edge that arrives from the control node, the return edge being an edge that arrives at the control node, the intersecting edge being a third edge different from the forward edge and the return edge;
the repeated depth traversal follows the following rules:
traversing the forward edge forward depth;
the returning edge does not carry out depth traversal;
and for the crossed edge, firstly traversing the type of the rear edge, if the front edge exists, continuing to traverse along the front edge, if the front edge does not exist, continuing to traverse along the crossed edge reaching the maximum sequence delay end point, and changing the type of the crossed edge reaching the maximum sequence delay end point into the front edge.
5. The visualization-based low-code program generation method of claim 4, wherein the calculating the control set for each node specifically comprises:
the control set of the starting node is the starting node itself at the beginning, and the control sets of other nodes are empty;
when the starting point s reaches the end point t, if the control set of the end point t is empty, then dom (t) ═ tuc dom(s), otherwise, dom (t) ═ dom (t) · d (s)) is not used.
6. The method for generating a program based on visualized low code according to claim 1, wherein the adjusting the edge type according to the control relationship between the nodes, and the determining the unique edge from the control node of each node specifically comprises:
if a certain node has a plurality of forwarding edges, the forwarding edges except the forwarding edge with the largest sequence number keep the original type, and the other forwarding edges all adjust the type to be a cross edge.
7. The method for visually generating a low-code program according to claim 1, wherein the determining the code types of the code blocks, the nesting levels, and the edges, and the generating the program code specifically includes:
marking the cyclic code blocks;
marking edges in the circulation;
marking branch code blocks;
classifying and marking nesting levels of the code blocks;
program code is generated.
8. An apparatus for visually low-code based program generation, the apparatus comprising:
the data loading module is used for acquiring and loading flow chart data, wherein the flow chart data comprises nodes and edges of a flow chart, the edges comprise an IN edge and an OUT edge, the OUT edge represents the edge of the node, and the IN edge represents the edge of the node;
the OUT edge sorting module is used for determining the order of the OUT edges of the nodes by repeatedly traversing the subgraph behind a certain node;
the node sequencing module is used for determining the sequence of control nodes and edges of the nodes through repeated depth traversal and judging the types of the edges, wherein the control nodes are nodes necessary for reaching a certain node;
the edge type adjusting module is used for adjusting the edge type according to the control relation among the nodes and determining the only edge of each node which arrives from the control node;
and the program generation module is used for determining the code types of the code blocks, the nesting layers and the edges, generating a program code and generating an application program according to the program code.
9. A computer device, characterized in that it comprises a processor and a memory, in which a computer program is stored, which is loaded and executed by the processor to implement the visualization low code based program generation method according to any of claims 1 to 7.
10. A computer-readable storage medium, in which a computer program is stored, which is loaded and executed by a processor to implement the visualization low code-based program generation method according to any one of claims 1 to 7.
CN202111614439.XA 2021-12-27 2021-12-27 Program generation method, device, equipment and medium based on visual low code Active CN114461198B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111614439.XA CN114461198B (en) 2021-12-27 2021-12-27 Program generation method, device, equipment and medium based on visual low code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111614439.XA CN114461198B (en) 2021-12-27 2021-12-27 Program generation method, device, equipment and medium based on visual low code

Publications (2)

Publication Number Publication Date
CN114461198A true CN114461198A (en) 2022-05-10
CN114461198B CN114461198B (en) 2024-05-28

Family

ID=81406981

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111614439.XA Active CN114461198B (en) 2021-12-27 2021-12-27 Program generation method, device, equipment and medium based on visual low code

Country Status (1)

Country Link
CN (1) CN114461198B (en)

Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5339238A (en) * 1991-03-07 1994-08-16 Benson Thomas R Register usage tracking in translating code for different machine architectures by forward and reverse tracing through the program flow graph
US20080052670A1 (en) * 2006-08-04 2008-02-28 Apple Computer, Inc. Graphically Depicting Program Code Depth
US7430733B1 (en) * 2007-11-15 2008-09-30 International Business Machines Corporation Method for validation of binary code transformations
WO2010064260A1 (en) * 2008-12-01 2010-06-10 Kpit Cummins Infosystems Ltd. Method and system for parallelization of sequencial computer program codes
US7765097B1 (en) * 2006-03-20 2010-07-27 Intuit Inc. Automatic code generation via natural language processing
US20110107315A1 (en) * 2009-10-30 2011-05-05 International Business Machines Corporation Abstracting benefit rules from computer code
US8359586B1 (en) * 2007-08-20 2013-01-22 The Mathworks, Inc. Code generation
CN102915242A (en) * 2012-09-26 2013-02-06 北京广利核系统工程有限公司 Method for implementing code programming by graphical operations
CN103823666A (en) * 2013-11-05 2014-05-28 国电南瑞科技股份有限公司 Smart substation equipment visualized programming method
US9152390B1 (en) * 2007-09-07 2015-10-06 Cadence Design Systems, Inc. Generating modular and hierarchical execution code from untimed and timed block diagrams
CN106020120A (en) * 2016-07-29 2016-10-12 芜湖哈特机器人产业技术研究院有限公司 Method for generating G code by using image based on ios system
CN106202006A (en) * 2016-06-27 2016-12-07 北京百度网讯科技有限公司 Document generating method and device
US20170068581A1 (en) * 2015-09-04 2017-03-09 International Business Machines Corporation System and method for relationship based root cause recommendation
CN107704235A (en) * 2017-09-22 2018-02-16 深圳航天科技创新研究院 The analytic method of data flowchart, system and storage medium in mathematics library
CN109656568A (en) * 2018-12-28 2019-04-19 黑龙江省工业技术研究院 On-demand reducible program control flowchart figure accessibility indexing means
CN110531967A (en) * 2019-08-16 2019-12-03 北京三快在线科技有限公司 Code generating method and code generating unit
CN111240687A (en) * 2020-01-09 2020-06-05 华东师范大学 Source code static analysis device
CN113655996A (en) * 2021-08-04 2021-11-16 北京航空航天大学 Enterprise-level system generation method based on demand model

Patent Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5339238A (en) * 1991-03-07 1994-08-16 Benson Thomas R Register usage tracking in translating code for different machine architectures by forward and reverse tracing through the program flow graph
US7765097B1 (en) * 2006-03-20 2010-07-27 Intuit Inc. Automatic code generation via natural language processing
US20080052670A1 (en) * 2006-08-04 2008-02-28 Apple Computer, Inc. Graphically Depicting Program Code Depth
US8359586B1 (en) * 2007-08-20 2013-01-22 The Mathworks, Inc. Code generation
US9152390B1 (en) * 2007-09-07 2015-10-06 Cadence Design Systems, Inc. Generating modular and hierarchical execution code from untimed and timed block diagrams
US7430733B1 (en) * 2007-11-15 2008-09-30 International Business Machines Corporation Method for validation of binary code transformations
WO2010064260A1 (en) * 2008-12-01 2010-06-10 Kpit Cummins Infosystems Ltd. Method and system for parallelization of sequencial computer program codes
US20110107315A1 (en) * 2009-10-30 2011-05-05 International Business Machines Corporation Abstracting benefit rules from computer code
CN102915242A (en) * 2012-09-26 2013-02-06 北京广利核系统工程有限公司 Method for implementing code programming by graphical operations
CN103823666A (en) * 2013-11-05 2014-05-28 国电南瑞科技股份有限公司 Smart substation equipment visualized programming method
US20170068581A1 (en) * 2015-09-04 2017-03-09 International Business Machines Corporation System and method for relationship based root cause recommendation
CN106202006A (en) * 2016-06-27 2016-12-07 北京百度网讯科技有限公司 Document generating method and device
CN106020120A (en) * 2016-07-29 2016-10-12 芜湖哈特机器人产业技术研究院有限公司 Method for generating G code by using image based on ios system
CN107704235A (en) * 2017-09-22 2018-02-16 深圳航天科技创新研究院 The analytic method of data flowchart, system and storage medium in mathematics library
CN109656568A (en) * 2018-12-28 2019-04-19 黑龙江省工业技术研究院 On-demand reducible program control flowchart figure accessibility indexing means
CN110531967A (en) * 2019-08-16 2019-12-03 北京三快在线科技有限公司 Code generating method and code generating unit
CN111240687A (en) * 2020-01-09 2020-06-05 华东师范大学 Source code static analysis device
CN113655996A (en) * 2021-08-04 2021-11-16 北京航空航天大学 Enterprise-level system generation method based on demand model

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
ILM柚籽: "Simulink自动代码生成原理", Retrieved from the Internet <URL:https://www.cnblogs.com/simulink/p/5289238.html> *
MINGCHENG QU等: "A Novel Algorithm of Error Check and Code Generation for Structured Flowchart", 《JOURNAL OF HARBIN INSTITUTE OF TECHNOLOGY(NEW SERIES)》, vol. 24, no. 4, 7 April 2017 (2017-04-07), pages 18 - 30 *
王黎明等: "程序流程图到代码的自动生成算法", 《西安电子科技大学学报》, vol. 39, no. 6, 12 September 2012 (2012-09-12), pages 70 - 77 *
田贝: "设计稿(UI视图)自动生成代码方案的探索", Retrieved from the Internet <URL:https://tech.meituan.com/2021/03/25/ui2dsl-dsl2code.html> *

Also Published As

Publication number Publication date
CN114461198B (en) 2024-05-28

Similar Documents

Publication Publication Date Title
Liu et al. NCTU-GR 2.0: Multithreaded collision-aware global routing with bounded-length maze routing
CN108509335B (en) Software test data generation method based on genetic algorithm optimization
WO2016169286A1 (en) Workshop layout method for discrete manufacturing system
CN106919957B (en) Method and device for processing data
CN101377851A (en) System and method for computing a minimum distance from point cloud to point cloud
CN112650248A (en) Routing inspection robot path planning method and system based on improved genetic algorithm
CN112733486B (en) Intelligent wiring method and system for chip design
CN104915251A (en) Task scheduling method and device
CN113311829A (en) Multi-robot path planning method based on dynamic time window conflict search
CN104635709B (en) Flexible comprehensive scheduling method considering double targets of cost and time
CN111238519B (en) Multi-unmanned vehicle road finding method based on topological map and conflict elimination strategy
CN113312874A (en) Overall wiring method based on improved deep reinforcement learning
CN109961129A (en) A kind of Ocean stationary targets search scheme generation method based on improvement population
CN113315650A (en) Node layout method and device
CN114461198A (en) Program generation method, device, equipment and medium based on visual low code
US7937390B2 (en) Method for controlling a relational database system
CN112837322A (en) Image segmentation method and device, equipment and storage medium
US20230129871A1 (en) Robot master control system
CN111370055A (en) Intron retention prediction model establishing method and prediction method thereof
CN111160831B (en) Task generation method and device for intensive warehouse and electronic equipment
CN115258509A (en) Method and device for selecting items and computer readable storage medium
CN108491687A (en) Based on contig quality evaluations classification and scheme the scaffolding methods optimized
CN111259806B (en) Face area identification method, device and storage medium
CN109726895B (en) Multi-target-point task execution planning method and device
Agnihotri et al. Fast analytic placement using minimum cost flow

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant