ST language extension method, system and equipment fusing syntactic sugar and medium
By integrating Java syntactic sugar to extend the ST language, the problems of cumbersome and error-prone array operations in the ST language are solved, and efficient and easy-to-use array traversal and Boolean operations are achieved, supporting cross-platform code reuse and portability.
Patent Information
- Application Number
- CN202411024823.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-11-22
AI Technical Summary
The existing PLC programming language ST is cumbersome and error-prone when performing array operations, especially when iterating through arrays, batch processing, and performing Boolean operations, which can easily lead to out-of-bounds errors. Furthermore, it does not support branching judgments for string variables, which limits the reusability and portability of the code.
This approach extends the ST language by incorporating Java syntactic sugar, providing functions such as foreach, stream, multi-array iteration, string branching, and direct bit manipulation. It generates ST code compliant with the IEC61131-3 standard through lexical analysis, syntax analysis, and semantic analysis, supports efficient array traversal and Boolean operations, and converts the extended syntax into a standard ST language representation.
It simplifies array manipulation code, avoids out-of-bounds issues, improves development efficiency and code quality, and achieves cross-platform code reuse and portability.
Smart Images

Figure CN119002933A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of compiled language extension, and in particular to an ST language extension method, system, device and medium integrating syntactic sugar. Background Art
[0002] The IEC61131-3 standard is an international standard for programmable logic controller (PLC) programming issued by the International Electrotechnical Commission. The standard defines five PLC programming languages, including instruction list (IL), structured text (ST), ladder diagram (LD), sequential function chart (SFC), and function block diagram (FBD). Among them, structured text (ST) language is a text programming language similar to C language. It supports process-oriented and object-oriented programming methods and is widely used to process complex logic and large amounts of data.
[0003] As PLC and its peripherals gradually develop towards large-scale and complex directions, the number of variables in PLC programs also shows a rapid growth trend. In this case, arrays, as the only collection-type data structure in the IEC61131-3 standard, have been widely used in PLC programs. Therefore, the traversal and access processing of array elements and the interoperation between arrays play an important role in realizing control logic.
[0004] However, the array operations currently supported by the ST language are relatively low-level, which makes the writing process cumbersome and prone to out-of-bounds access problems.
[0005] According to the IEC61131-3 standard, when using ST (Structured Text) language to traverse an array, only iteration statements or exhaustive methods can be used. Exhaustive methods will generate a lot of similar codes and are rarely used. ST language iteration statements include FOR, WHILE, and REPEAT. There is little difference between the three when traversing an array. If you want to traverse a one-dimensional BOOL type array to count the number of elements with a value of TRUE, taking the FOR statement as an example, you need to perform the following operations (assuming that the array name is arr_of_bool_4_10, and the array start and end indexes are [4, 10]): define the FOR loop control index variable idx; define the variable count to store the statistical results; set the initial value of idx to the array start index 4, the end value of idx to the array end index 10, and the increment step is 1 in the FOR statement; judge the array element at the current index position in the FOR loop body, and if its value is TRUE, add 1 to the variable count value.
[0006] The above operation has the following problems: (1) ST language does not support local scope variables, and loop control index variables and statistical variables need to be defined in advance, which makes the code more cumbersome; (2) The start and end index values of the loop control index variables need to be set manually, and the start and end indexes need to be ensured to be within the valid index range of the array. If the array definition is adjusted during code refactoring, array access out-of-bounds problems are very likely to occur during array access operations.
[0007] The problem of single array operation is still controllable. In actual PLC applications, there is a large demand for batch data exchange with external devices. The corresponding code needs to implement batch processing of two array elements. Compared with processing a single array, more variables are required, the code is more cumbersome, and the risk of array out of bounds is greater.
[0008] The above is just a simple operation of traversing array elements. If it is necessary to comprehensively apply element screening, filtering, numerical processing, statistics and other operations in the traversal process, the code will be more cumbersome and the potential for problems will be greater. In addition, different developers have different abilities, and the codes written to achieve the same function vary greatly, with uneven quality, which is not conducive to code maintenance and reuse.
[0009] The CASE statement of the ST (Structured Text) language (similar to the SWITCH statement of the Java language) only supports the use of ANY_INT type variables, but not string types. When you actually need to use string variables for multi-branch comparison processing, you either have to use IF statements instead, or set the mapping relationship between strings and values, which is a roundabout way to achieve the goal and is rather cumbersome.
[0010] In actual PLC (Programmable Logic Controller) applications, a large number of Boolean variables are involved. In the process of interacting with peripherals and internal processing, due to the need to save storage space and limited by external interaction formats, a large number of Boolean operations on ANY_INT (any integer type) and ANY_BYTE (any byte type) type variables usually appear. However, the current PLC standard (such as ST language) does not directly provide the function of reading and writing bits of ANY_INT and ANY_BYTE type variables. Therefore, to implement the corresponding functions, usually only rely on the function extensions provided by the PLC development software. This approach is not only inconvenient to implement the functions, but also limits the reusability of the code between different development software.
[0011] In response to the problems of ST language in actual PLC applications, most PLC software manufacturers have extended the functions of ST (Structured Text) language in different ways. Although these extended syntaxes and underlying implementation principles are different, they are all bound to their compilers and even PLC runtime environments, and do not have the ability to be ported and reused between different PLC software. Summary of the invention
[0012] Based on this, it is necessary to provide an ST language expansion method, system, device and medium integrating syntactic sugar to address the above problems.
[0013] In a first aspect, the present invention provides a method for extending an ST language by integrating syntactic sugar, the method comprising the following steps: S1, read the ST source file using the extended syntax features and generate a lexical symbol stream; S2, read the lexical symbol stream and generate an extended syntax tree based on the extended ST grammar; S3, traverse the extended syntax tree and update the type information of each node in the extended syntax tree; S4. Based on the preset code detection rules, the validity of the extended syntax tree is detected; S5, traverse the extended syntax tree again and rewrite the code using the extended syntax into standard code; S6. Output code with the same semantics as that written using standard code.
[0014] Furthermore, reading the ST source file using the extended syntax feature and generating a lexical symbol stream includes the following steps: S11. Refer to the Java syntax sugar implementation mechanism, define syntax extension rules, perform syntax extension on the ST language, and read the ST source file that uses the extended ST syntax features; S12. Use a lexical analyzer to perform lexical analysis on the source code in the ST source file to generate a lexical symbol stream.
[0015] Furthermore, the syntax extension rules include array iteration rules based on range and automatic type deduction, data flow processing rules, batch processing rules between arrays, branch judgment rules and direct bit operation rules.
[0016] Further, traversing the extended syntax tree and updating the type information of each node in the extended syntax tree includes the following steps: S31, loading an extended library file written in standard ST language for assisting in implementing extended grammar functions; S32. Utilize the semantic analyzer in combination with the extended library file to traverse the extended syntax tree multiple times, generate the symbol table in sequence, update the type information of each node of the extended syntax tree, and fill the type and data type information of each extended syntax tree node into the symbol table and the node.
[0017] Furthermore, based on the preset code detection rules, the validity detection of the extended syntax tree includes the following steps: S41, setting code detection rules, wherein the code detection rules include grammar rules and extended grammar rules based on standard definitions; S42, performing validity detection on the extended syntax tree according to the detection rules, wherein the detection contents of the validity detection include type validity detection and program organization unit call validity detection; S43. If the extended syntax tree is detected as invalid, an error message is output and the process is terminated. If the extended syntax tree is detected as valid, step S5 is continued.
[0018] Furthermore, type validity detection means comparing whether the expected data type and the actual data type in the extended syntax tree node are compatible. If they are compatible, they are detected as valid, and if they are not compatible, they are detected as invalid. The program organization unit call validity check means to check whether there is a program organization unit with a specified name and parameter list in the symbol table. If it exists, it is detected as valid, and if it does not exist, it is detected as invalid.
[0019] Furthermore, traversing the extended syntax tree again, rewriting the code using the extended syntax into standard code includes the following steps: S51, traversing the extended syntax tree, identifying each extended syntax node in the extended syntax tree; S52: Convert the code corresponding to each grammar extension rule into a standard code using the standard ST language and having the same semantics, and record the reference information of each extension library.
[0020] In a second aspect, the present invention further provides an ST language extension system integrating syntactic sugar, the system comprising: Lexical analysis module, used to read ST source files using extended grammar features and generate lexical symbol streams; Syntax analysis module, used to read the lexical symbol stream and generate an extended syntax tree based on the extended ST grammar; The semantic analysis module is used to traverse the extended syntax tree and update the type information of each node in the extended syntax tree; A code detection module is used to detect the validity of the extended syntax tree based on preset code detection rules; The code rewriting module is used to traverse the extended syntax tree again and rewrite the code using the extended syntax into standard code; Output rewrite code module, used to output code with the same semantics as written using standard code.
[0021] In a third aspect, the present invention further provides a computer device.
[0022] In some embodiments, the computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0023] In a fourth aspect, the present invention also provides a computer-readable storage medium.
[0024] In one embodiment, a computer program is stored on a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0025] The beneficial effects of the present invention are: 1. By drawing on the syntax rules and implementation mechanism of Java syntax sugar and combining the actual situation of ST language, the syntax sugars such as Java language foreach and switch using string variables are integrated into ST language, which expands the language function, provides high-order iteration methods for collection types, encapsulates iteration details, and frees programmers from the tedious details of maintaining index validity and consistency, which can improve program development efficiency and fundamentally avoid the problem of out-of-bounds access caused by array traversal.
[0026] 2. By integrating stream and supporting the foreach function of multiple groups, the ST language has expanded the functional programming to provide standard and efficient implementations for some commonly used functions, thus improving the ease of use and convenience of the ST language.
[0027] 3. By carefully designing the rewriting strategy of the extended syntax, it supports converting the ST code using the extended syntax into the code with the same semantics expressed in the standard ST language. The converted code can be compiled using any compiler compatible with the IEC61131-3 standard, and can be conveniently transplanted and reused on multiple PLC development platforms. Compared with other manufacturers' functional extensions for the ST language that rely on specific compilers, the syntax extensions of the present invention can be converted into codes with the same semantics expressed in the standard ST language, without relying on any compiler, and have good portability and functional reusability. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings: Figure 1 is a flowchart of an ST language expansion method integrating syntactic sugar according to an embodiment of the present invention; Figure 2 It is a logic flow chart of an ST language expansion method integrating syntactic sugar according to an embodiment of the present invention; Figure 3 is a principle block diagram of an ST language extension system integrating syntax sugar according to an embodiment of the present invention; Figure 4 FIG. 4 is a schematic diagram of the structure of a computer device according to an embodiment of the present invention.
[0029] Figure numbers: 1. Lexical analysis module; 2. Syntax analysis module; 3. Semantic analysis module; 4. Code detection module; 5. Code rewriting module; 6. Output rewriting code module. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0031] See also Figure 1-Figure 2 , provides an ST language expansion method integrating syntactic sugar, characterized in that the method comprises the following steps: S1. Read the ST source file using the extended syntax features and generate a lexical symbol stream.
[0032] In the description of the present invention, reading an ST source file using extended grammar features and generating a lexical symbol stream includes the following steps: S11. Refer to the Java syntax sugar implementation mechanism, define syntax extension rules, perform syntax extension on the ST language, and read the ST source files that use the extended ST syntax features.
[0033] Among them, in the description of the present invention, the syntax extension rules include array iteration rules based on range and automatic type deduction, data flow processing rules, batch processing rules between arrays, branch judgment rules and direct bit operation rules.
[0034] Specifically, for array iteration rules based on range and automatic type inference, it provides a high-order array traversal method to replace the ST (structured text) language FOR statement. Users do not need to deal with array indexes and iteration variables, but only need to write array element processing logic.
[0035] For data stream processing rules, it transplants Java's stream processing operation functions to ST language arrays, greatly simplifying the code writing for operations such as traversal, screening, and statistics of array elements. Supported stream operations include foreach, count, max, min, findFirst, findLast, and findAany.
[0036] For the batch processing rules between arrays, two arrays are given and the iteration range of the two arrays is specified, which can realize range-safe automatic element iteration access.
[0037] For branch judgment rules, the standard syntax only supports the use of ANY_INT type in CASE statements. If you need to make branch judgments based on STRING variables, either use IF statements instead or perform a mapping conversion from STRING to a numeric value. This function extension supports the use of STRING type variables for branch judgments in CASE statements.
[0038] For direct bit operation rules, it draws on the function of Java language string that can be used directly as a character array, expands the function of direct bit reading and writing of ANY_INT and ANY_BYTE, and treats ANY_INT and ANY_BYTE as one-dimensional BOOL arrays with specific length.
[0039] In summary, the extended syntax code is clear and easy to understand, and the cumbersome functional extension implementation details are implemented in a standard and efficient way, which can greatly improve development efficiency.
[0040] S12. Use a lexical analyzer to perform lexical analysis on the source code in the ST source file to generate a lexical symbol stream.
[0041] S2. Read the lexical symbol stream and generate an extended syntax tree based on the extended ST grammar.
[0042] Specifically, syntax analysis requires the use of a syntax analyzer to read a lexical symbol stream and generate an extended syntax tree based on an extended ST grammar.
[0043] S3. Traverse the extended syntax tree and update the type information of each node in the extended syntax tree.
[0044] In the description of the present invention, traversing the extended syntax tree and updating the type information of each node in the extended syntax tree includes the following steps: S31. Load an extension library file written in standard ST language to assist in implementing an extended syntax function.
[0045] Among them, the extended library file is the supporting file required to implement the extended syntax. It is written in the standard ST language and is similar to the library function defined by the standard.
[0046] S32. Use the semantic analyzer in combination with the extended library file to traverse the extended syntax tree multiple times, generate the symbol table in sequence, update the type information of each node in the extended syntax tree, and fill the type and data type information of each extended syntax tree node into the symbol table and node, so as to prepare for subsequent code detection and code rewriting.
[0047] S4. Based on the preset code detection rules, the validity of the extended syntax tree is checked.
[0048] In the description of the present invention, based on the preset code detection rules, the validity detection of the extended syntax tree includes the following steps: S41. Setting code detection rules, wherein the code detection rules include grammar rules and extended grammar rules based on standard definitions.
[0049] S42. Perform validity check on the extended syntax tree according to the detection rules, wherein the validity check includes type validity check and program organization unit (POU) call validity check.
[0050] In the description of the present invention, type validity detection means comparing whether the expected data type and the actual data type in the extended syntax tree node are compatible. If they are compatible, they are detected as valid; if they are not compatible, they are detected as invalid.
[0051] The program organization unit call validity check means to check whether there is a program organization unit with a specified name and parameter list in the symbol table. If it exists, it is detected as valid, and if it does not exist, it is detected as invalid.
[0052] S43. If the extended syntax tree is detected as invalid, an error message is output and the process is terminated. If the extended syntax tree is detected as valid, step S5 is continued.
[0053] S5. Traverse the extended syntax tree again and rewrite the code using the extended syntax into standard code.
[0054] In the description of the present invention, traversing the extended syntax tree again and rewriting the code using the extended syntax into the standard code includes the following steps: S51. Traverse the extended syntax tree and identify each extended syntax node in the extended syntax tree.
[0055] S52: Convert the code corresponding to each grammar extension rule into a standard code using the standard ST language and having the same semantics, and record the reference information of each extension library.
[0056] Among them, according to whether the extended syntax conversion requires the use of an extended library, the conversion rules can be divided into conversion rules that do not use an extended library and conversion rules that use an extended library (see below for specific examples). In this process, automatic type deduction, extended library calls, and other operations are performed, and in addition, the references to each extended library need to be recorded.
[0057] S6. Output the extended library code referenced by the standard code and the rewritten standard code.
[0058] See also Figure 3 , and also provides an ST language extension system integrating syntactic sugar, the system comprising: The lexical analysis module 1 is used to read the lexical symbol stream and generate an extended syntax tree based on the extended ST grammar.
[0059] The syntax analysis module 2 is used to read the lexical symbol stream and generate an extended syntax tree based on the extended ST grammar.
[0060] The semantic analysis module 3 is used to traverse the extended syntax tree and update the type information of each node in the extended syntax tree.
[0061] The code detection module 4 is used to perform validity detection on the extended syntax tree based on preset code detection rules.
[0062] The code rewriting module 5 is used to traverse the extended syntax tree again and rewrite the code using the extended syntax into standard code.
[0063] The output rewriting code module 6 is used to output codes with the same semantics written using the standard code.
[0064] In a specific embodiment, in order to solve the problems existing in the ST (structured text) language, such as cumbersome array element traversal processing, easy to cause data access out of bounds; cumbersome batch operations between arrays; CASE statement does not support string variables; does not support bit reading and writing of ANY_INT and ANY_BIT, the present invention refers to Java syntax sugar, combines the ST (structured text) language syntax and application characteristics, and expands the ST (structured text) language syntax to solve the above problems.
[0065] PLC (Programmable Controller) software manufacturers have extended the syntax of ST (Structured Text) language to varying degrees, but these syntax extensions rely on specific compilers, limiting the porting and reuse of programs between different software. The present invention can convert the code using the extended syntax into a standard-compliant code with equivalent functions by designing the implementation method and processing flow of the extended syntax, which can be used on any standard-compliant compiler. While achieving functional expansion, it can also take into account portability and code reuse capabilities.
[0066] As a widely used high-level language, Java provides a rich set of data types. For these collection types, Java implements unified, convenient, safe, and efficient collection element traversal, access, and processing operations through syntax sugars such as foreach and stream.
[0067] The implementation principle of Java language syntax sugar is as follows: when a Java program is executed, the compiler first compiles the Java source code to generate intermediate code in bytecode format, and then the Java virtual machine (JVM) interprets and executes the bytecode. Java syntax sugar is actually some syntax extensions that are convenient for users to use. These extensions only exist in the code editing stage and some compilation stages. In the process of compiling a Java program to generate bytecode, the compiler will "desugar" these syntax sugars, that is, convert the code containing syntax sugars into code implemented using standard Java syntax elements through code rewriting. For some complex syntax sugar conversions, it is necessary to develop a dedicated underlying API or processing framework. The code after "desugaring" no longer contains any syntax sugar information, and there is no essential difference from Java code without syntax sugar. Therefore, the generated bytecode file does not contain any syntax sugar information, so the JVM does not perceive the syntax sugar and does not need to perform any processing.
[0068] Antlr is a powerful compiler generator that can generate lexical analyzers and syntax analyzers. It is similar to the combination of Flex and Bison in terms of function. Its syntax file uses the EBNF (Extended Backus-Naur Form) format. Antlr can automatically generate corresponding lexical analyzers, syntax analyzers, and syntax tree traversers (supporting listener mode and visitor mode) based on the syntax file. In addition, it also supports lexical flow rewriting, which can rewrite and output source code according to needs during the syntax tree traversal process. Antlr4 is the AntlrV4 version, which is also the latest version.
[0069] Due to the limitations of the standard ST syntax, there are problems such as cumbersome and error-prone coding in scenarios such as array traversal, array element processing, array batch operation, CASE branch judgment, ANY_INT, ANY_BYTE direct bit operation, etc., which affects the PLC program development efficiency and code quality.
[0070] The grammar extension rules introduced in the present invention are all grammar extensions of the ST language with reference to the Java grammar sugar implementation mechanism in order to solve the above problems.
[0071] Each extended grammar rule is independent of each other. (1), (2), and (3) are newly added grammars, and (4) and (5) are functional extensions of existing grammars. The following is an introduction and example of each grammar extension rule.
[0072] (1) Array iteration based on range and automatic type inference: foreach Function Overview: Provides a high-level array traversal method to replace the ST (Structured Text) language FOR statement. Users do not need to deal with array indexes and iteration variables, but only need to write data element processing logic.
[0073] Syntax extension: The grammar of the present invention uses the EBNF (Extended Backus-Naur Form) format, which will not be described in detail below.
[0074] The iteration_statement syntax rule adds a new foreach_statement branch iteration_statement: for_statement |while_statement |repeat_statement |exit_statement |foreach_statement; Syntax description: iteration_statement is a syntax production of the ST language. The standard syntax means that an iteration_statement can be a for_statement, a while_statement, a repeat_statement, or an exit_statement.
[0075] The extended syntax indicates that an iteration_statement can also be a foreach_statement.
[0076] The foreach_statement syntax rules are defined as follows: foreach_statement: 'FOREACH' '(' 'VAR_AUTO' IDENTIFIER ':' variable ')' statement_list / / statement_list represents a statement set, which consists of one or more statements. The statements can be those defined by the ST standard or those extended by the present invention. 'END_FOREACH'; This grammar rule means that a foreach_statement starts with the keyword FOREACH; followed by a (), the keyword VAR_AUTO inside the brackets, followed by an IDENTIFIER (identifier: a string of letters, numbers, and underscores), then a colon, and then a variable name; after the brackets is a statement_list (statement set: one or more statements), and finally ends with the keyword END_FOREACH.
[0077] Sample Code For example, we count the number of elements with a value of TRUE in a one-dimensional BOOL array named arr_of_bool_4_10 with the start and end indexes of [4, 10]. The ST (Structured Text) code using extended syntax is as follows: VAR count:=0:INT;END_VAR FOREACH(VAR_AUTO ele:arr_of_bool_4_10) IF ele THEN count:=count+1; END_IF; END_FOREACH; An example statement using standard ST (Structured Text) syntax is as follows: VAR idx:INT;END_VAR (*Additional definition of iteration index variable*) VAR count:INT;END_VAR FOR idx:=4 TO 10 BY 1 DO (*manually maintain array index*) IF arr_of_bool_4_10[idx] THEN count:=count+1; END_IF; END_FOR; When using the extended syntax, users no longer need to define array iteration variables, nor do they need to deal with array indexes. There is no need to synchronously maintain array indexes when the array definition changes, which can fundamentally avoid the problem of array access out of bounds.
[0078] (2) Array stream processing: stream Functional Overview The Java stream processing function is transplanted to the ST language array, which greatly simplifies the code writing for operations such as traversal, screening, and statistics of array elements. Supported stream operations include foreach, count, max, min, findFirst, findLast, and findAny.
[0079] Syntax extensions Added stream_statement branch to statement syntax rules statement : / / empty statement (*Syntax rule comment*) |assignment_statement |subprogram_control_statement |selection_statement |iteration_statement |stream_statement Syntax description: statement is an existing grammar production formula of ST language. The grammar rule indicates that a statement can be an empty statement (without any content), or an assignment_statement, or a subprogram_control_statement (subroutine call statement, function call or function_block call), or a selection_statement (selection statement: if statement or case statement), or an iteration_statement.
[0080] The extended syntax means that a statement can also be a stream_statement.
[0081] The stream_statement syntax rules are defined as follows: stream_statement : variable'.stream' '(' ('find_flag:=' variable)? (*Optional, records whether the target element is found*) (, 'idx_flag:=' variable)? (*Optional, record the index of the target element found*) ')' ('.filter' '('lambda_cond')')? (*Optional, filter elements based on condition*) ('.foreach' '(' lambda_expression ')')? (*Optional, perform the specified operation on each element*) ('.' ('count()' | 'max()' | 'min()' | 'avg()' | 'findFirst()' | 'findLast()' | 'findAny()')?; (*Optional, perform find statistics analysis*) Syntax description: stream_statement is an extended ST syntax production, which means that a stream_statement starts with a variable, followed by a period (.), and then the keyword stream; followed by a pair of brackets, inside which are two optional parameter assignment statements, multiple parameter assignment statements are separated by commas, the first optional parameter assignment starts with the constant string find_flag:=, followed by a variable, the second optional parameter assignment starts with the constant string idx_flag:=, followed by a variable; the brackets can be followed by one or zero filter statements, one or zero element operation statements, and one or zero function execution statements.
[0082] The filter statement starts with the constant string .filter, followed by a pair of parentheses, inside which is a lambda_cond (defined and explained below).
[0083] The element operation statement starts with the constant string .foreach, followed by a pair of parentheses, inside which is a lambda_expression (the definition and description are given below).
[0084] The function execution statement starts with a constant string., followed by a pair of brackets. The brackets can contain any of the following string constants representing specific functions. The meanings of each string constant are as follows: count() counts the number of max() calculates the maximum value min() calculates the minimum value avg() calculates the average findFirst() checks the first element: the find_flag variable marks the search result, and the idx_flag variable marks the index findLast() checks the last element: the find_flag variable marks the search result, and the idx_flag variable marks the index findAny() checks any element: the find_flag variable marks the search result, and the idx_flag variable marks the index lambda_cond:variable ' ->' expression; (*filter condition*) lambda_cond is an extended ST grammar production, which means that a lambda_cond (lamda condition) starts with a variable, followed by a string constant ->, and finally an expression (expression, ST language already has grammar production).
[0085] lambda_expression:variable '->' statement+; (*Specify the operation to be performed on the element*) lambda_expression is an extended ST grammar production, which means that a lambda_expression (lamda expression) starts with a variable, followed by a string constant ->, and then followed by one or more statements (statements, ST language already has grammar productions).
[0086] Sample Code Take the example of counting the maximum value of the elements in a one-dimensional INT type array named arr_of_int with the start and end indexes of the array being [4, 10] that meet the conditions (the return value of calling the match_fun function is true) The extended syntax code is as follows: VAR var_find_flag:BOOL; var_idx_flag:INT; matched_max_val:INT; END_VAR arr_of_int.stream(find_flag:=var_find_flag, idx_flag:=var_idx_flag).filter(r->match_fun(r)).max(); The following is an example statement using standard ST syntax: VAR var_find_flag:=false:BOOL; var_idx_flag:=-1:INT; matched_max_val:=-1:INT; idx: INT; (*Additional definition of iteration index variable*) END_VAR FOR idx:=4 TO 10 BY 1 DO (*manually maintain array index*) IF match_fun(arr_of_int[idx])THEN IF NOT var_find_flag THEN var_find_flag:=true; (*Manually maintain query results*) matched_max_val:= arr_of_int[idx]; (*Manually maintain the maximum value index*) var_idx_flag:=idx; ELSIF arr_of_int[idx]>matched_max_val THEN matched_max_val:= arr_of_int[idx]; (*Manually maintain the maximum value*) var_idx_flag:=idx; (*Manually maintain the maximum value index*) END_IF; END_IF; END_FOR; Using the extended syntax, the corresponding function can be implemented with one line of code, eliminating the cumbersome processing logic.
[0087] (3) Batch processing between arrays Functional Overview Given two arrays and specifying the iteration range of the two arrays, range-safe automatic element iteration access can be achieved.
[0088] Syntax extensions The foreach_statement rule now has branching syntax for handling multiple groups.
[0089] foreach_statement: (*For details on the syntax rules for handling single arrays, see Extended Rule 1*) | 'FOREACH' '(' 'VAR_AUTO' IDENTIFIER ',' IDENTIFIER ': ' (*mark array iteration element*) variable ',' variable ': ' (*Specify two arrays to be iterated*) subrange ',' subrange (*specify the iteration range of two data*) ')' statement_list (*operation statements for array elements*) 'END_FOREACH'; Syntax description: foreach_statement is an extended ST syntax production, which has been described in (1). This rule is a production branch that extends the foreach_statement statement based on (1). It means that foreach_statement can be a statement described in rule (1), or it can start with the keyword FOREACH, followed by a pair of parentheses, the parentheses start with the keyword VAR_AUTO, followed by two IDENTIFIERs separated by commas, followed by a colon, followed by two variables separated by commas, followed by a colon, followed by two subranges separated by commas.
[0090] Following the brackets is a statement_list (a set of statements: one or more statements), which ends with the keyword END_FOREACH.
[0091] Sample code: Take the example of traversing two data named arr1 and arr2, both of which have element type INT and index range [1, 10] [11, 20], and calling a function using array elements as parameters. The extended syntax code is as follows: FOREACH (VAR_AUTO var1, var2: arr1, arr2: 1..10, 11..20) do_somthing(var1, var2); END_FOREACH; The following is an example statement using standard ST syntax: VAR idx1:INT; END_VAR (*Additional definition of index variables*) VAR idx2:INT; END_VAR FOR idx1:=1 TO 10 BY 1 DO IF idx1<1 OR idx1>10 THEN (*Boundary validity check to avoid crossing the boundary*) EXIT; END_IF; idx2:=idx1+10; (*Manually maintain index relationship*) IF idx2<10 OR idx2>20 THEN (*Boundary validity check to avoid crossing the boundary*) EXIT; END_IF; do_somthing(arr1[idx1], arr2[idx2]); END_FOR; Based on the extended syntax, the function can be implemented using concise code without manually handling array indexes and avoiding out-of-bounds access.
[0092] (4) The CASE statement uses the STRING variable for branch judgment Functional Overview The standard syntax only supports the use of ANY_INT type in CASE statements. If you need to perform branch judgment based on STRING variables, either use IF statements instead or perform a mapping conversion from STRING to a numeric value. This function extension supports the use of STRING type variables for branch judgment in CASE statements.
[0093] Syntax extensions Added alternative branches to the case_list rule, which can use one or more string values case_list: (case_list_element(',' case_list_element)*) |character_string(',' character_string); Syntax description: case_list is an existing grammar production formula of ST language, which represents each selection branch in CASE statement. In the existing rules, case_list can only consist of one or more case_list_element separated by commas (see the glossary for specific meanings).
[0094] The newly expanded grammar rule indicates that case_list can also consist of one or more character_strings separated by commas (see the glossary for specific meanings).
[0095] Sample Code Take the example of determining the specific method to be called based on the value of a string variable str_var The extended syntax code is as follows: VAR str_var :STRING; END_VAR CASE str_var OF 'a', 'b' : func_1(); 'c' : func_2(); ELSE func_0(); END_CASE; The following is an example statement using standard ST syntax: FUNCTION strHash:ULINT (*Predefined function to implement string to numeric mapping*) VAR_INTPUT str:STRING; END_VAR (*STRING HASH algorithm implementation*) END_FUNCTION VAR str_var:STRING; END_VAR CASE str_var.strHash() OF (* string to value *) strHash('a'), strHash('b'): (* string to value *) IF str_var = 'a' OR str_var = 'b' THEN (*Handle possible value mapping conflicts*) func_1(); END_IF; strHash('c'): IF str_var='c' THEN func_2(); END_IF; ELSE func_0(); END_CASE; The extended syntax code is concise and natural to achieve the same function. The standard syntax requires pre-defining the mapping function from string to value, and then converting each string into a value using the mapping function. In addition, it is necessary to handle possible mapping conflicts of the mapping function.
[0096] (5) ANY_INT, ANY_BYTE direct bit operations Functional Overview Drawing on the Java language's ability to use a string directly as a character array, this paper expands the ability to directly read and write bits of ANY_INT and ANY_BYTE, and treats ANY_INT and ANY_BYTE as one-dimensional BOOL arrays with a specific length.
[0097] Syntax extensions There is no need to expand the grammar rules. The array element access branch of the multi_element_variable grammar rule can be reused directly to expand the functions at the semantic level. This supports bit operations on ANY_INT and ANY_BYTE that are not arrays using array methods.
[0098] multi_element_variable: variable_name | (*Other build branches*) |multi_element_variable'['expression (COMMA expression)*']' (*reuse this branch*); Syntax description: multi_element_variable is an existing syntax production expression in ST semantics, which indicates a multi-element variable (including structure fields and array elements). It can be generated by several other rules (not relevant to this function, omitted), or it can start with a multi_element_variable (multi-element variable), followed by a pair of square brackets, and the brackets contain one or more expressions (ST expressions) separated by commas.
[0099] The difference before and after the expansion is that before the expansion, the multi_element_variable must be an array type variable, and after the expansion, the multi_element_variable can also be an ANY_INT or ANY_BYTE type variable.
[0100] Sample Code Take the data synchronization of an array named arr_bool with an index range of [0, 31] and an element type of BOOL with four variables as an example (set the element value of the array index [0, 15] to the BYTE type variable para1 and the INT type variable para2, synchronize the element value of the array index [16, 23] to the BYTE type variable para3, and synchronize the element value of the array index [24, 31] to the INT type variable para4) The extended syntax code is as follows (using foreach and direct bit access at the same time): VAR arr_bool: ARRAY[0..31]OF BOOL; para1:BYTE; para2:INT; para3:BYTE; para4:INT; END_VAR foreach (var_auto bit1, bit2: arr_bool, para1: 0..7, 0..7) bit1:=bit2; end_foreach; foreach (var_auto bit1, bit2: arr_bool, para2: 8..15, 0..7) bit1:=bit2; end_foreach; foreach (var_auto bit1, bit2: arr_bool, para3: 16..23, 0..7) bit2:=bit1; end_foreach; foreach (var_auto bit1, bit2: arr_bool, para4: 24..31, 0..7) bit2:=bit1; end_foreach; The following is an example statement using standard ST syntax: The standard syntax does not support direct bit reading and writing of ANY_INT and ANY_BYTE. To implement direct bit reading and writing, you need to pre-encapsulate the bit reading and writing functions for each data type, and then implement the bit reading and writing operations based on these functions.
[0101] (*Pre-defined bit read function*) FUNCTION getAnyIntBit:BOOL VAR_INTPUT para:ANY_INT;END_VAR VAR_INTPUT idx:INT;END_VAR / / Specific implementation END_FUNCTION (*Pre-defined bit read function*) FUNCTION getAnyByteBit:BOOL VAR_INTPUT para:ANY_BYTE;END_VAR VAR_INTPUT idx:INT;END_VAR / / Specific implementation END_FUNCTION (*Pre-defined bit write function*) FUNCTION setAnyIntBit:ANY_INT VAR_INTOUT para:ANY_INT;END_VAR VAR_INTPUT idx:INT;END_VAR VAR_INTPUT val:BOOL;END_VAR / / Specific implementation END_FUNCTION (*Pre-defined bit write function*) FUNCTION setAnybyteBit:ANY_INT VAR_INTOUT para:ANY_BYTE;END_VAR VAR_INTPUT idx:INT;END_VAR VAR_INTPUT val:BOOL;END_VAR / / Specific implementation END_FUNCTION (*Function implementation code*) VAR arr_bool: ARRAY[0..31] OF BOOL para1:BYTE; para2:INT; para3:BYTE; para4:INT; idx:INT; (*Additional definition of index variables*) END_VAR FOR idx:=0 TO 7 BY 1 DO arr_bool[idx]:=getAnyByteBit(para1,idx); (*call function*) arr_bool[idx+8]:=getAnyIntBit(para1,idx+8); (*manually maintain the index*) setAnyByteBit(para3, idx, arr_bool[idx+16]); (*manually maintain the index*) setAnyIntBit(para4, idx, arr_bool[idx+24]); (*manually maintain the index*) END_FOR; The extended syntax code is clear and easy to understand, and the tedious functional extension implementation details are implemented in a standard and efficient way, which can greatly improve development efficiency.
[0102] like Figure 2 As shown, it is the processing flow of extending the Java syntax features (the five syntax extension rules defined above) of the ST language and generating ST code that complies with the IEC61131-3 standard.
[0103] Antlr is a compiler generator similar to Flex+Bison. For a language, use the Antlr agreed format to write lexical files and grammar files, and then use the tools provided by Antlr to generate lexical analysis programs and grammar analysis programs based on the lexical files and grammar files. Combining these generated codes according to a certain process can read the ST source code file and perform lexical analysis and grammar analysis in turn to generate lexical symbol streams and grammar trees. Altlr4 is the V4 version of Antlr.
[0104] After determining the extended grammar, use the Antlr4 convention format to write the extended grammar file (lexical rules + grammar rules), and then use the Antlr4 tool chain to write the corresponding lexical analyzer, grammatical analyzer and semantic analyzer according to the extended grammar file.
[0105] In addition, in the process of extending the code, it is necessary to determine whether the extension library is needed based on the extension syntax conversion. The conversion rules can be divided into conversion rules that do not use the extension library and conversion rules that use the extension library. In this process, automatic type deduction, extension library calls, and other operations will be performed. In addition, the references to each extension library need to be recorded.
[0106] Extended code rewrite example: The extended code rewriting mainly includes the following steps: identifying the extended syntax nodes, generating the symbol table and node type information according to the corresponding strategy combined with the semantic analysis based on the extended syntax type, and converting them into standard ST codes with the same semantics.
[0107] (1) Rewritten example without extension library: foreach For details on the extended syntax, see Section 4.1, Item 1.
[0108] When traversing the syntax tree nodes, if a node is a syntax node corresponding to the syntax rule foreach_statement (foreach statement), the following operations are performed for the node in the semantic analysis and code detection phase: a) Search the symbol corresponding to the variable node text in the symbol table and check whether its type is an array type. If not, terminate and report an error.
[0109] b) Check the validity of the array element type according to the standard definition. If invalid, terminate and report an error.
[0110] c) Record the array type information in the variable (syntax rule: variable) node, including the array element type and array dimension.
[0111] During the code rewriting phase, rewrite according to the following steps: a) Extract the text corresponding to the IDENTIFIER node, assuming it is arr_item (just an English name) b) Get the element type of the array corresponding to the variable (syntax rule: variable) node, assuming the type is BOOL (Boolean).
[0112] c) Get the dimension information of the array corresponding to the variable (syntax rule: variable) node, assuming it is a one-dimensional array with start and end indexes [4, 10].
[0113] d) Define the control index variable for traversing the array, and insert the statement VAR (ST keyword, start defining variables) _auto_gen_arr_idx (just an English name): INT (integer type); END_VAR (ST keyword, end of variable definition) after the variable definition of the POU (program organization unit) to which the current statement belongs.
[0114] e) Define data element access variables, insert the statement VAR (ST keyword, start variable definition) arr_item (just an English name): BOOL (Boolean); END_VAR ST keyword, end of variable definition) after the variable definition of the POU to which the current statement belongs.
[0115] f) Insert array traversal framework code FOR (ST keyword, start FOR loop) idx (just an English name, indicating index) := 4 TO (ST keyword, to) 10 BY (ST keyword, index increment step for each loop) 1 DO (ST keyword, from DO to END_FOR is the loop body) END_FOR (ST keyword, end FOR loop); g) Insert the iteration variable assignment statement arr_item (just an English name) := arr (just an English name) [_auto_gen_arr_idx (just an English name)] in the FOR (ST keyword, indicating the FOR statement) statement body (between DO and END_FOR); h) Add the foreach loop statements to the FOR (ST keyword, indicating a FOR statement) statement body.
[0116] i) Replace the text corresponding to the foreach_statement (ST new syntax rule, foreach statement) node with the newly generated code text.
[0117] (2) Example of including extension libraries: CASE (ST keyword, similar to Java language switch) statement using STRING (string) type variable In order to support the STRING type as a CASE branch variable, a corresponding extension library is required. The extension library receives a STRING type parameter and outputs an integer using an appropriate hash algorithm. That is, an extension library function similar to the following is implemented: FUNCTION (ST keyword, indicating the start of function definition) STRING_HASH (just a name): INT (integer type) VAR_INPUT (ST keyword, input variable definition starts) str (just a name): STRING (string); END_VAR (ST keyword, variable definition ends) (*hash algorithm implementation*) END_FUNCTION (ST keyword, indicating the end of function definition) When traversing the syntax tree nodes, if a node is a syntax node corresponding to the syntax rule case_statement (case statement), the following operations are performed for the node in the semantic analysis and code detection phase: a) Calculate and confirm that the type of expression representing the CASE branch variable is ANY_INT (any integer type) or STRING (string) b) If expression is of type STRING, calculate and check whether each case_list_element node is of type STRING. If not, terminate and report an error.
[0118] During the code rewriting phase, rewrite according to the following steps: a) Determine whether the expression node type is STRING. If not, terminate.
[0119] b) Call the STRING_HASH (previously defined function name) function with the expression node code content as a parameter to convert the node content into the corresponding hash value. Assuming the original content is expression-text (just a name), replace the node content with STRING_HASH (expression-text) and record a reference to the extension library function STRING_HASH.
[0120] c) Process each case_element in turn.
[0121] d) Process each case_list_element in case_element, first get the content of each case_list_element and use it as a parameter to call STRING_HASH (the function name defined above) to convert its content into the corresponding hash value e) Process the statement_list node in case_element. Because the hash function itself is a many-to-one mapping, the hash values of different strings may be the same. Therefore, when the hash values match, the string contents must be compared, that is, the statement_list node contents are wrapped with an IF statement.
[0122] f) Replace the text corresponding to the case_statement node with the newly generated code text.
[0123] The present invention refers to the Java language foreach, stream and other syntax sugars for common array traversal, processing, batch assignment and other operations to expand the ST language with simple, easy-to-use and uniformly formatted syntax functions, thereby simplifying code development and essentially avoiding the array out-of-bounds problem; in view of the limitations of CASE statements and the lack of ANY_INT and ANY_BIT bit operation functions, the present invention provides these functions by extending the ST (structured text) syntax; at the same time, in view of the problem that function extensions of different manufacturers rely on compilers and are not interchangeable and reusable, the present invention converts the code using the extended ST syntax into a code with equivalent semantics that complies with the IEC61131-3 standard by designing the implementation and processing flow of the extended syntax, and can be used on any compiler compatible with the IEC61131-3 standard and PLC (programmable logic controller) development software, thereby achieving portability and reusability.
[0124] In summary, with the help of the above technical solution of the present invention, by drawing on the syntax rules and implementation mechanism of Java syntax sugar, combined with the actual situation of ST language, the syntax sugars such as Java language foreach and case using string variables are integrated into ST language, the language function is expanded, and a high-order iteration method is provided for collection types, which encapsulates iteration details, frees programmers from the tedious details of maintaining index validity and consistency, and fundamentally avoids the problem of out-of-bounds access caused by array traversal. By integrating stream and supporting the foreach function of most groups, functional programming is expanded for ST language, providing standard and efficient implementation for some commonly used functions, and improving the ease of use and convenience of ST language.
[0125] By carefully designing the rewriting strategy of the extended syntax, it supports converting the ST code using the extended syntax into the code with the same semantics expressed in the standard ST language. The converted code can be compiled using any compiler compatible with the IEC61131-3 standard, and can be conveniently transplanted and reused on multiple PLC development platforms. Compared with other manufacturers' functional extensions for the ST language that rely on specific compilers, the syntax extensions of the present invention can be converted into codes with the same semantics expressed in the standard ST language, do not rely on any compiler, and have good portability and functional reusability.
[0126] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store static information and dynamic information data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in the above method embodiment are implemented.
[0127] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0128] In addition, the present invention also provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiment when executing the computer program.
[0129] In addition, the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiment are implemented.
[0130] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0131] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
Claims
1. A ST language extension method integrating syntactic sugar, characterized in that: The method comprises the following steps: S1, read the ST source file using the extended syntax features and generate a lexical symbol stream; S2, read the lexical symbol stream and generate an extended syntax tree based on the extended ST grammar; S3, traverse the extended syntax tree and update the type information of each node in the extended syntax tree; S4. Based on the preset code detection rules, the validity of the extended syntax tree is detected; S5, traverse the extended syntax tree again and rewrite the code using the extended syntax into standard code; S6. Output code with the same semantics as that written using standard code.
2. The ST language expansion method integrating syntactic sugar according to claim 1, characterized in that: The method of reading the ST source file using the extended grammar feature and generating a lexical symbol stream comprises the following steps: S11. Refer to the Java syntax sugar implementation mechanism, define syntax extension rules, perform syntax extension on the ST language, and read the ST source file that uses the extended ST syntax features; S12. Use a lexical analyzer to perform lexical analysis on the source code in the ST source file to generate a lexical symbol stream.
3. The ST language expansion method integrating syntactic sugar according to claim 2, characterized in that: The grammar extension rules include array iteration rules based on range and automatic type deduction, data flow processing rules, batch processing rules between arrays, branch judgment rules and direct bit operation rules.
4. The ST language expansion method integrating syntactic sugar according to claim 1, characterized in that: The traversing of the extended syntax tree and updating the type information of each node in the extended syntax tree comprises the following steps: S31, loading an extended library file written in standard ST language for assisting in implementing extended grammar functions; S32, using a semantic analyzer in combination with the extended library file, traversing the extended syntax tree multiple times, generating a symbol table in sequence, updating the type information of each node of the extended syntax tree, and filling the type and data type information of each extended syntax tree node into the symbol table and the node.
5. The ST language expansion method integrating syntactic sugar according to claim 1, characterized in that: The validity detection of the extended syntax tree based on the preset code detection rules includes the following steps: S41, setting code detection rules, wherein the code detection rules include grammar rules and extended grammar rules based on standard definitions; S42, performing validity detection on the extended syntax tree according to the detection rules, wherein the detection contents of the validity detection include type validity detection and program organization unit call validity detection; S43. If the extended syntax tree is detected as invalid, an error message is output and the process is terminated. If the extended syntax tree is detected as valid, step S5 is continued.
6. The ST language expansion method integrating syntactic sugar according to claim 5, characterized in that: The type validity detection means comparing the expected data type and the actual data type in the extended syntax tree node to see whether they are compatible. If they are compatible, they are detected as valid; if they are not compatible, they are detected as invalid. The program organization unit call validity detection means searching the symbol table for a program organization unit with a specified name and parameter list. If so, it is detected as valid; if not, it is detected as invalid.
7. The ST language expansion method integrating syntactic sugar according to claim 1, characterized in that: The step of traversing the extended syntax tree again and rewriting the code using the extended syntax into the standard code includes the following steps: S51, traversing the extended syntax tree, identifying each extended syntax node in the extended syntax tree; S52: Convert the code corresponding to each grammar extension rule into a standard code using the standard ST language and having the same semantics, and record the reference information of each extension library.
8. An ST language expansion system integrating syntactic sugar, used to implement the ST language expansion method integrating syntactic sugar as described in any one of claims 1 to 7, characterized in that: The system includes: Lexical analysis module, used to read ST source files using extended grammar features and generate lexical symbol streams; Syntax analysis module, used to read the lexical symbol stream and generate an extended syntax tree based on the extended ST grammar; The semantic analysis module is used to traverse the extended syntax tree and update the type information of each node in the extended syntax tree; A code detection module is used to detect the validity of the extended syntax tree based on preset code detection rules; The code rewriting module is used to traverse the extended syntax tree again and rewrite the code using the extended syntax into standard code; Output rewrite code module, used to output code with the same semantics as written using standard code.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
System for converting rule into Python language
CN120610752A
PLC honey point-oriented structured text code generation method
CN122386884A
