CN113568607B - Digital program implementation method and system - Google Patents
Digital program implementation method and system Download PDFInfo
- Publication number
- CN113568607B CN113568607B CN202110909661.6A CN202110909661A CN113568607B CN 113568607 B CN113568607 B CN 113568607B CN 202110909661 A CN202110909661 A CN 202110909661A CN 113568607 B CN113568607 B CN 113568607B
- Authority
- CN
- China
- Prior art keywords
- data
- statement
- program
- digital program
- name
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 75
- 230000006870 function Effects 0.000 claims abstract description 80
- 230000014509 gene expression Effects 0.000 claims description 56
- 230000008569 process Effects 0.000 claims description 41
- 238000011161 development Methods 0.000 claims description 14
- 125000004122 cyclic group Chemical group 0.000 claims description 11
- 238000004321 preservation Methods 0.000 claims description 8
- 239000003999 initiator Substances 0.000 claims description 4
- 230000009191 jumping Effects 0.000 claims description 3
- 239000007858 starting material Substances 0.000 description 5
- 238000012986 modification Methods 0.000 description 4
- 230000004048 modification Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 2
- 238000012423 maintenance Methods 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
The invention provides a digital program implementation method and a digital program implementation system, which specifically comprise the following steps: setting a program developed by a program language as a parent program, and setting a digital program with a relatively independent number outside the parent program, wherein the parent program comprises a digital program engine; according to the function to be realized, the parent program reads in the digital program with the designated number, and the digital program engine operates the corresponding sentence operation device according to the sentence category thereof to realize the required program function. The repeated code and the actual running code of the parent program are reduced, and the size of the executable file after compiling is reduced. For a real-time uninterrupted operation system, the parent program can be updated in operation, so that the problem that the parent program can be updated only when the parent program stops operation in the past is solved.
Description
Technical Field
The present invention relates to the field of program development technologies, and in particular, to a method and a system for implementing a digital program.
Background
At present, the program development is that the source program is compiled to form an executable program. If the function is to be modified, the source program must be modified, a new executable program is recompiled, after no problem is caused in the test, the original program is stopped, and the new program is restarted to run after replacing the old program. This solution has insufficient flexibility, and even with minor modifications, a series of processes are performed, taking time and effort. For a real-time uninterrupted operation system, the system operation must be stopped for each modification and upgrade in this way, and then the system is upgraded, so that the service influence is larger.
An important function of the program is to operate and process data, the original development mode mainly comprises the steps of firstly declaring variables, carrying out data assignment on the variables, then operating the variables, and writing a plurality of lines of codes, which is relatively complex.
Disclosure of Invention
Aiming at the defects existing in the prior art, the invention aims to provide a digital program implementation method and a digital program implementation system, which realize the way that a section of program is independently stored and operated in a parameterized way outside an executable program, and realize flexible development and modification of program functions; the problem that for a real-time uninterrupted operation system, the system operation must be stopped and then the system is upgraded in the traditional mode every time when the system is modified and upgraded is solved, and the service influence is large; in addition, the invention adopts a data bus mode to define data, and can directly and conveniently reference and operate each data in the software.
In order to achieve the above purpose, the specific technical scheme adopted by the invention is as follows:
the digital program realizing method specifically comprises the following steps:
s1, setting a program developed by a program language as a parent program, and setting digital programs with relatively independent numbers outside the parent program, wherein the parent program comprises a digital program engine;
s2, reading a digital program with a designated number by a parent program according to the function to be realized, and running a corresponding statement operator according to the statement category by a digital program engine to realize the required program function, wherein the digital program engine is a program function or a process.
Preferably, the operation flow and form of the digital program are as follows: writing a digital program by adopting text editing, and storing the digital program into a text format; or converting the text format to a canonical format using a pre-processing program; or a special software is adopted to interactively define the digital program content to generate a standard format comprising a database, xml, json and a custom format, and the digital program adopts an encryption or non-encryption mode.
Preferably, the statement class of the digital program includes one or more of variable declaration, operation assignment statement, if condition statement, for loop statement, while loop statement, switch statement, continuous statement, break statement, procedure call, sql statement, call of other digital program, interface control operation, digital program end, annotation;
In the sentence categories, if conditional sentences, for cyclic sentences, while cyclic sentences and switch sentences control the operation of a single or a plurality of related sentence groups, and the sentence groups adopt specific symbol marks or formats to determine the starting and ending ranges of the sentence groups; the annotation does not require the parent program to operate;
preferably, variable names and/or a software data bus form according to data type + name are used in the digital program statement to define data, and the data bus form data is represented by a data tag and/or a format field;
the data tag adopts one or more of a one-dimensional tag, a two-dimensional tag and a three-dimensional tag, wherein the two-dimensional tag represents data according to the data category and the name and comprises a start symbol, a data category, a separator, a name and an end symbol; the three-dimensional tag represents data according to data type, data category and name, and comprises a start symbol, a data type, a separator, a data category, a name and an end symbol; the one-dimensional label is a simplified mode of a two-dimensional label and is used for representing data commonly used in a program, and comprises a start symbol, a name and an end symbol; the initiator, terminator and separator comprise one or more characters; or the data tag adopts a simplified mode, and omits one or more of a start symbol, an end symbol and a separator; the arrangement sequence of the data category and the name in the tag can be data category and name or name and data category;
The format field is used in a format preservation digital program and is divided into a single field, a double field and a three field according to the number of the fields, one or more of the single field, the double field and the three field are adopted according to requirements, the double field is respectively a data type, a data type and a data name, the data tag is used for representing the data in the single field, and the format preservation refers to adopting a database, xml, json or a self-defined format;
the data category is various data sources in software, and comprises, but is not limited to, constants, custom variables, data entered by an interface, program call parameters, text files, sql data, json and xml according to different development languages.
Preferably, for the data tag in the digital program statement in the parent program, a first function or process is adopted to replace the data tag with a corresponding actual data value; for a format field in a digital program statement, invoking a first function or a process for a single field to carry out numerical replacement on a data tag in the single field; the second function is called for the double fields to acquire actual data; for the three fields, firstly, according to the category and the name or taking actual data, and then converting the actual data from a character string to a specified data type;
The first function or process is used for scanning the data tag in the input character string parameter to acquire actual data, replacing the data tag with the actual data and finally returning result data;
the second function is to obtain the actual data value according to the data category and name, and return the data value.
Preferably, the statement executor specifically refers to a set of program statements in a parent program for implementing functions of each digital program statement, where the set of program statements includes: one or more of a variable declaration statement applicator, an operation assignment statement applicator, an if conditional statement applicator, a for loop statement applicator, a while loop statement applicator, a switch statement applicator, a continuous statement applicator, a break statement applicator, a procedure call applicator, an sql statement applicator, an invoke other digital program applicator, an interface control operation applicator, and a program end applicator.
Preferably, the variable declaration operator allocates a variable to the declaration variable in the variables defined in advance in the parent program or uses the object of some parent program language to correspond a variable to the declaration variable, and the reference operation of the variable in other statement operators actually corresponds to the operation parent program variable;
The operation assignment statement runner flow comprises:
calculating the right expression of the assignment symbol, and running the corresponding function in the parent program for the function in the expression;
and assigning the right expression result to the parent program variable corresponding to the assignment object variable.
Preferably, (1) the if statement executor runs the specified range statement according to the specified condition, two forms of the if condition statement are:
if conditional expression then statement 1/statement group 1;
if conditional expression then statement 1/statement group 1else statement 2/statement group 2;
the process of the operator is as follows:
(a1) Calculating a conditional expression;
(b1) Selecting to run statement 1 or statement group 1 when the conditional expression result is true;
(c1) If the expression result is false, if else statement exists, then running statement 2 or statement group 2; the operation refers to the explanation operation of the digital program of the appointed row by calling the digital program engine;
(2) The for loop sentence operator correspondingly operates the specified range sentences according to the specified conditions, and the for loop sentence forms are as follows:
for (variable name=initial value; conditional expression; untailed cycle body)
A set of associative sentences;
the process of the operator is as follows:
(a2) The parent program allocation variable corresponds to a for variable name;
(b2) For new for variable value = start value;
(c2) Sequentially running for association sentences;
(d2) Running a non-tail cyclic body sentence;
(e2) Calculating conditional expressions
(f2) The c2-e2 is circularly operated when the conditional expression is satisfied, and the for loop sentence is ended when the conditional expression is not satisfied;
(3) The while loop sentence operator calls the digital program engine to sequentially operate while associated sentences according to the appointed condition when the while condition value is true, and the form is as follows:
while conditional expression
A sentence group;
the process of the operator is as follows:
(a3) Calculating conditional expressions
(b3) When the result is true, the related sentences are run in sequence;
(c3) Circularly running a3-b3 until the conditional expression is not true;
(4) A switch statement operator for operating the specified statement or group of statements according to different values for the specified variable;
the swich statement is in the form of:
switch variable
{
case data value 1: statement 1/statement group 1;
case data value 2: statement 2/statement group 2;
...
case data value n, statement n/statement group n;
default: statement/statement group;
}
the switch statement runner flow is:
(a4) Obtaining switch variable values
(b4) Sequentially comparing the case data values, if the case data values are the same, executing the sentences or the sentence groups defined in the case sentences, and then finishing the operation of the switch sentences;
(c4) If the comparison is not successful and a default statement is defined, executing the statement or the statement group in the default statement;
(5) The continuous operator is used for jumping to the next cycle check in the associated statement group of the for and while statements, and the current cycle does not execute the following statements;
(6) The break runner is used for ending the statement group running in the associated statement group of the for, while, switch statement.
Preferably, the interface operation operator operates the attribute of the interface control according to the control name;
the procedure call operator respectively acquires corresponding procedure parameters according to the procedure names and calls corresponding internal procedures in the parent procedure;
the sql statement operator executes the sql statement after the parent program acquires the sql statement;
calling other digital program operators, reading the digital program with the designated number, and calling a digital program engine to operate the digital program;
the interface operation operator operates the attribute of the interface control according to the control name
The program ending operator ends the digital program operation of the current indication range;
the program annotation runner does not operate for the parent program.
The digital program realizing system comprises a mother program and a digital program with relatively independent numbers arranged outside the mother program, wherein the mother program is a program developed by a program language and comprises a digital program engine; according to the function to be realized, the parent program reads in the digital program with the designated number, and the digital program engine operates the corresponding sentence runner according to the sentence category to realize the required program function, wherein the digital program engine is a program function or a process.
The invention has the beneficial effects that:
1. the digital program is flexible to develop and modify, and after the digital program is modified, the mother program does not need to be recompiled, only needs to re-read the digital program, so that the development and release process is simplified, and the development time is saved.
2. The traditional mode uses program codes for each data acquisition, and the data bus mode is used for describing operation data, so that the program codes in the aspect of data acquisition are reduced, and the development efficiency is improved.
3. The master program can be compiled and generated, has high operation efficiency, can set internal functions according to the needs, is flexibly developed, and solves the problems that the whole interpreter is large in size, occupies more space and has low operation efficiency when the traditional interpreter language is required to realize all functions.
4, each new functional process developed in the traditional mode needs to be developed and debugged to determine the reliability, and the invention aims at different digital programs, and the same digital program engine code is actually operated, so that the software quality reliability is higher;
5. the size of the parent program is fixed, and does not become larger as the digital program is increased, and the size of the compiled executable file is reduced compared with the size of the traditional mode;
6. The new function can be realized without stopping the operation of the parent program, and for a real-time uninterrupted operation system, the problem that the operation is to be interrupted in upgrading and maintenance is solved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a digital program implementation method and prior art of the present invention;
fig. 2 is a flowchart of a parent program calling a digital program.
Fig. 3 is a flowchart of the digital program engine P1.
Fig. 4 is a flow chart of the first function P2.
Fig. 5 is a flow chart of the second function P3.
Fig. 6 is a flow chart of a third function P4.
Fig. 7 is a flowchart of the basic arithmetic expression P5.
Fig. 8 is a flowchart of the formula operator P6.
Fig. 9 is a flowchart of the conditional expression operator P7.
FIG. 10 illustrates an assignment statement operator flow chart.
Fig. 11 if conditional statement runner flowchart.
FIG. 12 for loop sentence runtime flowchart.
FIG. 13 while loop statement runner flowchart.
FIG. 14 is a switch statement runner flowchart.
FIG. 15 invokes a process runner flow diagram.
FIG. 16 calls other digital program operator flowcharts.
FIG. 17 is a flow chart of an interface control operation operator.
FIG. 18 SQL statement runtime flowchart.
FIG. 19 is a schematic diagram of a software data bus.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, other embodiments that may be obtained by those of ordinary skill in the art without making any inventive effort are within the scope of the present invention.
As shown in fig. 1-19, the present invention provides a digital program implementation method, which specifically includes the following steps:
s1, setting a program developed by a program language as a parent program, and setting digital programs with relatively independent numbers outside the parent program, wherein the parent program comprises a digital program engine;
s2, reading a digital program with a designated number by a parent program according to the function to be realized, and running a corresponding statement operator according to the statement category by a digital program engine to realize the required program function, wherein the digital program engine is a program function or a process.
Preferably, the operation flow and form of the digital program are as follows: writing a digital program by adopting text editing, and storing the digital program into a text format; or converting the text format to a canonical format using a pre-processing program; or a special software is adopted to interactively define the digital program content to generate a standard format comprising a database, xml, json and a custom format, and the digital program adopts an encryption or non-encryption mode.
From the flow, there are three operational flows and forms of digital programs
(1) Textualized digital program-parent program operation
The original digital program is written in a text editing mode, one sentence is in a row, and the digital program is operated after the parent program is read.
(2) Textualized digital program-preprocessor-generated digital program specification format-parent program run
The original digital program is written by text editing, the original text is normalized and checked by the preprocessing program to generate a normalized format, and the digital program is operated after the mother program reads the normalized format.
(3) The method comprises the steps of finishing digital program input-generating a digital program standard format-running a parent program by using a custom developed tool software, defining digital program content in a convenient operation mode without manually inputting source codes by the tool software, generating a standard format, and running the digital program after the parent program reads the standard format.
(4) The textually digital program or the normative format digital program may be in an unencrypted or encrypted manner. If encryption is performed, a decryption operation is performed in the parent program.
Secondly, a digital program standard format:
line number statement class statement parameters
Sentence types are different, and sentence parameters are correspondingly different;
preferably, the statement class of the digital program includes one or more of variable declaration, operation assignment statement, if condition statement, for loop statement, while loop statement, switch statement, continuous statement, break statement, procedure call, sql statement, call of other digital program, interface control operation, digital program end, annotation;
in the sentence categories, if conditional sentences, for cyclic sentences, while cyclic sentences and switch sentences control the operation of a single or a plurality of related sentence groups, and the sentence groups adopt specific symbol marks or formats to determine the starting and ending ranges of the sentence groups; the annotation does not require the parent program to operate;
1. the local variable declares:
line number variable declaration variable type variable name;
2, operation assignment statement:
variable expression of row number operation assignment result
If conditional statement:
line number if (conditional expression) line number 1, line number 2ELSE line number 3, line number 4
If the if condition is met, executing only one statement, wherein the line number 1 is the same as the line number 2, and if the ELSE is not available, the line number 3 and the line number 4 are empty; if the ELSE has only one statement, then line number 3 is the same as line number 4.
For loop statement:
line number For (variable name=value 1, value 2, end statement) line number 1, line number 2
While loop statement:
line number While (conditional expression) line number 1, line number 2
Switch statement:
line number switch variable
Line number case data value 1: line number 11, line number 1n;
line number statement 11;
line number.
Line number statement 1n;
line number case data value 2: line number 21, line number 2n
Line number statement 21;
line number.
Line number statement 2n;
line number case data value n: line number n1, line number nn
Line number statement n1;
line number.
Line number sentence nn;
line number default: line number d1, line number dn
Line number statement d1;
line number.
Line number statement dn;
the statement continue:
line number continuous
Break statement:
line number break;
9. operating an interface control;
line number control operation control name, control attribute and numerical value
10. Function call:
line number function call function name function parameter
Sql statement:
line number SQL running SQL statement
12. Invoking other digital programs:
line number calling digital program number
13. The digital program ends:
line number program end
13. Digital program annotation:
the annotation parent program is not operated, and no statement is generated;
preferably, variable names and/or a software data bus form according to data type + name are used in the digital program statement to define data, and the data bus form data is represented by a data tag and/or a format field;
the data tag adopts one or more of a one-dimensional tag, a two-dimensional tag and a three-dimensional tag, wherein the two-dimensional tag represents data according to the data category and the name and comprises a start symbol, a data category, a separator, a name and an end symbol; the three-dimensional tag represents data according to data type, data category and name, and comprises a start symbol, a data type, a separator, a data category, a name and an end symbol; the one-dimensional label is a simplified mode of a two-dimensional label and is used for representing data commonly used in a program, and comprises a start symbol, a name and an end symbol; the initiator, terminator and separator comprise one or more characters; or the data tag adopts a simplified mode, and omits one or more of a start symbol, an end symbol and a separator; the arrangement sequence of the data category and the name in the tag can be data category and name or name and data category;
The format field is used in a format preservation digital program and is divided into a single field, a double field and a three field according to the number of the fields, one or more of the single field, the double field and the three field are adopted according to requirements, the double field is respectively a data type, a data type and a data name, the data tag is used for representing the data in the single field, and the format preservation refers to adopting a database, xml, json or a self-defined format;
the data category is various data sources in software, and comprises, but is not limited to, constants, custom variables, data entered by an interface, program call parameters, text files, sql data, json and xml according to different development languages.
One-dimensional labels:
there are a number of commonly used variable values in the program, for which a simple label means is provided for the representation.
Data: representing the values of variables commonly used in the procedure.
Format: starter + name + terminator
[ # user name ] # user ID ] # current date ] # current time ]
Two-dimensional label:
a format: starter + data category + separator character + name + end character.
The data category may be a character, or a string, if a string, that separate character must exist.
Examples: input value of interface input control Name
In the name part, for some special data types, such as Json data, which contains a plurality of field data, an extension form can be adopted, and a 'name field' is adopted, and in the extension form, the relative field in the program is processed to obtain the field value.
Three-dimensional label:
returning specified data types
One style: starter + data type + data category + separator character + name + end character.
Adding a data type and a type separator on the basis of the two-dimensional label;
[ $ (int) enter. Score ] represents the input score of the interface enter control score
Preferably, for the data tag in the digital program statement in the parent program, a first function or process is adopted to replace the data tag with a corresponding actual data value; for a format field in a digital program statement, invoking a first function or a process for a single field to carry out numerical replacement on a data tag in the single field; the second function is called for the double fields to acquire actual data; for the three fields, firstly, according to the category and the name or taking actual data, and then converting the actual data from a character string to a specified data type;
The first function or process is used for scanning the data tag in the input character string parameter to acquire actual data, replacing the data tag with the actual data and finally returning result data;
the second function is to obtain the actual data value according to the data category and name, and return the data value.
Digital program engine: and reading the digital program data packet with the designated number, and correspondingly executing the actual instruction according to each instruction code.
Thirdly, the basic function process of the master program digital program engine and the operator is formed;
digital program engine P1 (start line, end line): reading in the designated number digital program data packet, and correspondingly executing the actual instruction according to each instruction code (fig. 3):
(1.1) get statement class
(1.2) if the sentence class=digital program ends, 0 is returned, ending the operation
(1.3) if statement class=break statement, 1 is returned and the operation is ended
(1.4) if statement class=continuous statement, 0 is returned and the operation is ended
(1.5) line corresponding sentence runner
(1.6) acquiring the next line number
(1.7) if the next line number < = line 2, return to run in step (1.1)
(1.8) returning to 0, ending the operation
A first function: p2 (content): the data label in the content is replaced after the actual data value is acquired (figure 4), and the flow is as follows;
(2.1) for input parameter A, scan data tag Starter '[ $'
(2.2) scanning data tag terminator' ], ending position B
(2.3) based on the positions of the start and end symbols, obtaining the data tag C and removing the intermediate strings of the start and end symbols
(2.4) from the intermediate string, separating the characters, obtaining the data class D and the name E, respectively
(2.5) calling a second function (D, E) to obtain the value F
(2.6) substituting the data tag C in A into F
(2.7) calculating the value F minus the length of the data tag C, which is G
(2.8) starting from position B+G and performing steps (2.1) to (2.6) until the end of the string
(2.9) processing of one-dimensional labels is started below, with a scanning position of 1.
(2.10) starting scanning of the data tag Starter [ # ] in A
(2.11) scanning the data tag terminator' ]. End position B2
(2.12) acquiring the name E2 in the data tag C2 and the data tag
(2.13) invoking a third function (E2) to obtain a value F2.
(2.14) substituting this data tag C2 with F2
(2.15) the length of F2 minus the length of the data tag C2 is calculated separately, the difference being G2
(2.16) continuing the scan from position B2+G2, performing (2.10) - (2.14) until the end of the string
The second function: p3 (category, name): acquiring actual data values according to categories and names (fig. 5);
(3.1) acquiring a category, name
(3.2) obtaining the numerical values from the corresponding data sources according to the categories and names, respectively
If the category is an input, a value is obtained from a control named Name
If the category is URL, the URL parameter value named Name is obtained from the URL
If the class is a custom variable, the custom variable value named Name is obtained
If the category is text file, the text file content with the Name of the file Name is read
...
(3.3) returning a result, wherein the type is a character string;
third function: p4 (name): acquiring a specified variable value according to the name (figure 6), wherein the flow is as follows;
(4.1) use switch (name) {
(4.2) Case "username" result = current username variable value; break;
(4.3) Case "current date": result = system date; break;
(4.4) Case "current time": result = current time; break;
...
(4.n)}
basic arithmetic expression: p5 (variable 1, operator, variable 2) (fig. 7), the flow is:
converting variable 1 and variable 2 into corresponding data types, performing arithmetic operation according to operators, and returning the results in a character string mode
The formula operator P6 (operation expression) (fig. 8) has the flow:
(5.1) calling P5 according to priority to complete a minimum operation first
(5.2) Loop 1 until all operators end
Conditional expression operation P7 (conditional expression) (fig. 9), the flow of which is:
(6.1) decomposing the expression according to the comparison operator;
(6.2) calling the formula arithmetic unit P6 by each small formula;
(6.3) according to the priority, sequentially comparing the comparison operators until all the comparison operators are completed;
(6.4) returning a result;
preferably, the statement executor specifically refers to a set of program statements in a parent program for implementing functions of each digital program statement, where the set of program statements includes: one or more of a variable declaration statement runner, an operation assignment statement runner, an if conditional statement runner, a for-loop statement runner, a while-loop statement runner, a switch statement runner, a continuous statement runner, a break statement runner, a procedure call runner, an sql statement runner, an interface control operation runner, and a program end runner.
Preferably, the variable declaration operator allocates a variable to the declaration variable in the variables defined in advance in the parent program or uses the object of some parent program language to correspond a variable to the declaration variable, and the reference operation of the variable in other statement operators actually corresponds to the operation parent program variable;
For example: in the parent program, a set of variables, int [ ] A, can be predefined;
defining variables int a, b, c in the digital program, and assigning a variable to A1 corresponding to a in the corresponding type; a2 corresponds to b and A3 corresponds to c
Some development languages, with Session objects, do not need to be predefined and can be used directly. For example, variable name score, directly using session [ "score" ], which is a string type, and converting according to a defined type when used
Return next line number = current line number +1;
operation assignment statement runner flow (fig. 10):
three basic formats of operation assignment statement:
(1) Assignment: result variable = variable 1
(2) And (3) operation: result variable = variable 1 operator variable 2
(3) Function: result variable = function name (expression)
The operators include: +add, -subtract,/divide,% remainder, mod modulo, < < shift left, > > shift right, string addition;
the result variable may be a declared local variable or a user-defined global variable;
data type: when the common operation is carried out, converting the character string into a corresponding data type according to the operation requirement to carry out the operation;
the process of the operator is as follows:
(7.1) for the operation formula in the function parameter, calling a formula operator P6;
(7.2) sequentially completing all function calculation;
(7.3) searching an innermost bracket formula, and calling a formula arithmetic unit P6;
(7.4) looping (7.1) - (7.3) until the operation is completed;
(7.5) assigning the result to the result object;
(7.6) returning the next line number to be the current line number +1;
preferably, (1) if statement runners
The operator flow is (fig. 11):
(a1) Calling an expression function P7, and calculating a conditional expression;
(b1) P1 (line number 1, line number 2) is selected according to the conditional expression result true;
(c1) If the expression result is false, if else statement exists, running P2 (line number 3, line number 4);
(d1) Returning to the next action (maximum of row number 2 and row number 4) +1;
(2) The for loop sentence operator correspondingly operates the specified range sentences according to the specified conditions, and the for loop sentence forms are as follows:
for (variable name=initial value; conditional expression; untailed cycle body)
A set of associative sentences;
the operator flow is (fig. 12):
(a2) The parent program allocation variable corresponds to a for variable name;
(b2) For new for variable value = start value;
(c2) Invoking the digital program engine P1 (line number 1, line number 2);
(d2) Running a non-tail cyclic body sentence;
(e2) Calling expression function P7 (conditional expression), calculating conditional expression
(f2) Circularly running c2-e2 until the conditional expression is out of formula;
(g2) Returning the next row number of 2+1;
(3) The while loop sentence operator calls the digital program engine to sequentially operate while associated sentences according to the appointed condition when the while condition value is true, and the form is as follows:
while conditional expression
A sentence group;
the flow of the operator is as follows (fig. 13):
(a3) Calling expression function P7 (conditional expression), calculating conditional expression
(b3) When it is true, a=call the digital program engine P1 (line number 1, line number 2) to run the associated statements in turn;
(c3) When A </SUB >1, loop running a3-c3 until the conditional expression is not true, ending the loop, returning to the next line number = line number 2+1
(d3) When a=1, break is internally run, the loop is ended, and the next line number=line number 2+1 is returned;
(4) A switch statement operator for operating the specified statement or group of statements according to different values for the specified variable; the swich statement is in the form of:
switch variable
{
case data value 1: statement 1/statement group 1;
case data value 2: statement 2/statement group 2;
...
case data value n, statement n/statement group n;
default: statement/statement group;
}
the switch statement runner flow is (fig. 14):
(a4) Obtaining switch variable values
(b4) Calling an expression function P7, comparing the switch variable value with the case data value in sequence, calling P1 (line number t1, line number t 2) for the line numbers t1 and t2 corresponding to the case if the switch variable value and the case data value are the same to execute a statement or a statement group defined in a case statement, and ending to finish the operation of the switch statement;
(c4) If the comparison is not successful and a default statement is defined, calling P1 to run the statement or the statement group in the default statement;
(d4) Returning the next line number to be the maximum line number +1 of the switch statement group;
(5) The continuous operator is used for jumping to the next cycle check in the associated statement group of the for and while statements, and the current cycle does not execute the following statements;
(a5) Ending the operation of the current P1 function;
(b5) P1 returns to 0;
(6) The break runner is used for ending the statement group running in the associated statement group of the for, while, switch statement.
(a6) Ending the operation of the current P1 function;
(b6) P1 returns to 1;
preferably, the process call operator obtains corresponding process parameters according to the process names, and calls corresponding internal processes in the parent program, wherein the flow is (fig. 15);
(a7) Acquiring a process name;
(b7) Converting parameter values in the digital program into data types required by the process parameters;
(c7) Executing the corresponding process in the parent program according to the process name;
(d7) Return next line number = current line number +1;
the interface operation operator operates the attribute of the interface control according to the control name (figure 16);
(a8) Acquiring control object according to control name
(b8) Operating on attributes of control objects
(c8) Return next line number = current line number +1;
invoking other digital program operator flow (fig. 17):
(a9) Reading a designated numbered digital program;
(b9) Invoking the digital program engine P1 to run the digital program
(c9) Return next line number = current line number +1;
an sql statement executor that executes the sql statement after the parent program obtains the sql statement (fig. 18);
(a10) Acquiring sql statements
(b10) Invoking an internal procedure to execute an sql statement
(c10) Return next line number = current line number +1;
the program ending operator ends the digital program operation of the current indication range;
for a more visual understanding, a digital software format is described below in comparison with a simple case:
program function: the user inputs the name, the language and the mathematics to form a line, if the total score is more than 160, the user displays excellent, otherwise, the user displays refueling; adding records to student's line list
Original digital program:
Int A;
a= [ $ (int) entered, chinese ] + [ $ (int) entered, math ];
if(A>160)then
Text= "excellent";
Else
text= "normal";
s= "insert into score (name, leson 1, leson 2) values (" + ", mathematical ])" are recorded.
SQL statement s;
structured digital program
Line number statement class statement parameters
1. Variable declaration int A
2. Assignment calculation A= [ $ (int) input Chinese ] + [ $ (int) input math ]
3 if instruction iF A >160 execution row (3, 3) ELSE (4, 4)
4. Control operation B shows excellent
5. Control operation B shows normal
6 SQL statement insert into score (name, leson 1, leson 2) values ('[ $enter. Name ]', [ $enter. Chinese ], [ $enter. Math ])
The invention also provides a digital program realizing system, which comprises a mother program and a digital program with relatively independent numbers arranged outside the mother program, wherein the mother program is a program developed by a program language and comprises a digital program engine; according to the function to be realized, the parent program reads in the digital program with the designated number, and the digital program engine operates the corresponding sentence runner according to the sentence category to realize the required program function, wherein the digital program engine is a program function or a process.
The invention has the advantages that:
1. the digital program is flexible to develop and modify, and after the digital program is modified, the mother program does not need to be recompiled, only the digital program needs to be re-read, the development process is simplified, and the development time is saved.
2. The traditional mode uses program codes for each data acquisition, and the data bus mode is used for describing operation data, so that the program codes in the aspect of data acquisition are reduced, and the development efficiency is improved.
3. The master program can be compiled and generated, has high operation efficiency, can set internal functions according to the needs, is flexibly developed, and solves the problems that the whole interpreter is large in size, occupies more space and has low operation efficiency when the traditional interpreter language is required to realize all functions;
4. each new functional process developed in the traditional mode needs to be developed and debugged to determine the reliability, and the invention aims at different digital programs, and the same digital program engine code is actually operated, so that the software quality reliability is higher.
5. The size of the parent program is fixed, and the size of the compiled executable file is reduced compared with the size of the traditional mode.
6. The new function can be realized without stopping the operation of the parent program, and for a real-time uninterrupted operation system, the problem that the operation is to be interrupted in upgrading and maintenance is solved.
With the above description of the preferred embodiments according to the present invention as a teaching, those skilled in the art can make various changes and modifications without departing from the scope of the technical idea of the present invention. The technical scope of the present invention is not limited to the description, but must be determined according to the scope of the claims.
Claims (8)
1. The digital program realizing method is characterized by comprising the following steps:
s1, setting a program developed by a program language as a parent program, and setting digital programs with relatively independent numbers outside the parent program, wherein the parent program comprises a digital program engine;
s2, reading a digital program with a designated number by a parent program according to the function to be realized, and running a corresponding statement operator according to the statement category by a digital program engine to realize the required program function, wherein the digital program engine is a program function or a process; defining data in the digital program statement by using variable names and/or a software data bus form according to data type and name, wherein the data bus form data is expressed by a data tag and/or a format field;
The data tag adopts one or more of a one-dimensional tag, a two-dimensional tag and a three-dimensional tag, wherein the two-dimensional tag represents data according to the data category and the name and comprises a start symbol, a data category, a separator, a name and an end symbol; the three-dimensional tag represents data according to data type, data category and name, and comprises a start symbol, a data type, a separator, a data category, a name and an end symbol; the one-dimensional label is a simplified mode of a two-dimensional label and is used for representing data commonly used in a program, and comprises a start symbol, a name and an end symbol; the initiator, terminator and separator comprise one or more characters; or the data tag adopts a simplified mode, and omits one or more of a start symbol, an end symbol and a separator; the arrangement sequence of the data category and the name in the tag can be data category and name or name and data category;
the format field is used in a format preservation digital program and is divided into a single field, a double field and a three field according to the number of the fields, one or more of the single field, the double field and the three field are adopted according to requirements, the double field is respectively a data type, a data type and a data name, the data tag is used for representing the data in the single field, and the format preservation refers to adopting a database, xml, json or a self-defined format;
The data category is various data sources in software, and comprises, but is not limited to, constants, custom variables, data entered by an interface, program calling parameters, text files, sql data, json and xml according to different development languages;
for the data labels in the digital program sentences in the parent program, adopting a first function or process to replace the data labels with corresponding actual data values; for a format field in a digital program statement, invoking a first function or a process for a single field to carry out numerical replacement on a data tag in the single field; the second function is called for the double fields to acquire actual data; for the three fields, acquiring actual data according to the category and the name, and converting the actual data from a character string to a specified data type;
the first function or process is used for scanning the data tag in the input character string parameter to acquire actual data, replacing the data tag with the actual data and finally returning result data;
the second function is to obtain the actual data value according to the data category and name, and return the data value.
2. The method for implementing a digital program according to claim 1, wherein the operation flow and form of the digital program are: writing a digital program by adopting text editing, and storing the digital program into a text format; or converting the text format to a canonical format using a pre-processing program; or a special software is adopted to interactively define the digital program content to generate a standard format comprising a database, xml, json and a custom format, and the digital program adopts an encryption or non-encryption mode.
3. The method according to claim 1, wherein the statement class of the digital program includes one or more of variable declaration, operation assignment statement, if condition statement, for loop statement, while loop statement, switch statement, continuous statement, break statement, procedure call, sql statement, call other digital program, interface control operation, digital program end, comment;
in the sentence categories, if conditional sentences, for cyclic sentences, while cyclic sentences and switch sentences control the operation of a single or a plurality of related sentence groups, and the sentence groups adopt specific symbol marks or formats to determine the starting and ending ranges of the sentence groups; the annotation does not require the parent program to do the operation.
4. A digital program implementation method according to claim 3, wherein the statement executor specifically refers to a set of program statements in a parent program for implementing its function for each digital program statement, and the set of program statements includes: one or more of a variable declaration statement applicator, an operation assignment statement applicator, an if conditional statement applicator, a for loop statement applicator, a while loop statement applicator, a switch statement applicator, a continuous statement applicator, a break statement applicator, a procedure call applicator, an sql statement applicator, an invoke other digital program applicator, an interface control operation applicator, and a digital program end applicator.
5. A digital program implementation method according to claim 4, wherein,
a variable declaration operator, which allocates a variable to the declaration variable in different development languages or in the variables predefined in the parent program, or uses the object of some parent program languages to correspond a variable to the declaration variable, and in other statement operators, the reference operation of the variable actually corresponds to the operation parent program variable;
the operation assignment statement runner flow comprises:
calculating the right expression of the assignment symbol, and running the corresponding function in the parent program for the function in the expression;
and assigning the right expression result to the parent program variable corresponding to the assignment object variable.
6. A digital program implementation method according to claim 4, wherein,
(1) The if statement operator correspondingly operates the statement in the specified range according to the specified condition, and two forms of the if condition statement are as follows:
if conditional expression then statement 1/statement group 1;
if conditional expression then statement 1/statement group 1else statement 2/statement group 2;
the process of the operator is as follows:
(a1) Calculating a conditional expression;
(b1) Selecting to run statement 1 or statement group 1 when the conditional expression result is true;
(c1) If the expression result is false, if else statement exists, then running statement 2 or statement group 2; the operation refers to the explanation operation of the digital program of the appointed row by calling the digital program engine;
(2) The for loop sentence operator correspondingly operates the specified range sentences according to the specified conditions, and the for loop sentence forms are as follows:
for (variable name=initial value; conditional expression; untailed cycle body)
A set of associative sentences;
the process of the operator is as follows:
(a2) The parent program allocation variable corresponds to a for variable name;
(b2) For new for variable value = start value;
(c2) Sequentially running for association sentences;
(d2) Running a non-tail cyclic body sentence;
(e2) Calculating a conditional expression;
(f2) Performing cyclic operation (c 2) - (e 2) when the conditional expression is satisfied, and ending the for cyclic sentence when the conditional expression is not satisfied;
(3) The while loop sentence operator calls the digital program engine to sequentially operate while associated sentences according to the appointed condition when the while condition value is true, and the form is as follows:
while conditional expression
A sentence group;
the process of the operator is as follows:
(a3) Calculating conditional expressions
(b3) When the result is true, the related sentences are run in sequence;
(c3) Circularly running (a 3) - (b 3) until the conditional expression is not true;
(4) A switch statement operator for operating the specified statement or group of statements according to different values for the specified variable; the swich statement is in the form of:
switch variable
{
case data value 1: statement 1/statement group 1;
case data value 2: statement 2/statement group 2;
...
case data value n, statement n/statement group n;
default: statement/statement group;
}
the switch statement runner flow is:
(a4) Obtaining switch variable values
(b4) Sequentially comparing the case data values, if the case data values are the same, executing the sentences or the sentence groups defined in the case sentences, and then finishing the operation of the switch sentences;
(c4) If the comparison is not successful and a default statement is defined, executing the statement or the statement group in the default statement;
(5) The continuous operator is used for jumping to the next cycle check in the associated statement group of the for and while statements, and the current cycle does not execute the following statements;
(6) The break runner is used for ending the statement group running in the associated statement group of the for, while, switch statement.
7. A digital program implementation method according to claim 4, wherein,
the procedure call operator respectively acquires corresponding procedure parameters according to the procedure names and calls corresponding internal procedures in the parent procedure;
the sql statement operator executes the sql statement after the parent program acquires the sql statement;
calling other digital program operators, reading the digital program with the designated number, and calling a digital program engine to operate the digital program;
The interface operation operator operates the attribute of the interface control according to the control name;
the digital program end operator ends the digital program operation of the current indicated range.
8. The digital program realizing system is characterized by comprising a mother program and a digital program with relatively independent numbers arranged outside the mother program, wherein the mother program is a program developed by a program language and comprises a digital program engine; according to the function to be realized, the parent program reads in the digital program with a designated number, and a digital program engine operates a corresponding statement operator according to the statement category of the digital program engine to realize the required program function, wherein the digital program engine is a program function or a process;
defining data in the digital program statement by using variable names and/or a software data bus form according to data type and name, wherein the data bus form data is expressed by a data tag and/or a format field;
the data tag adopts one or more of a one-dimensional tag, a two-dimensional tag and a three-dimensional tag, wherein the two-dimensional tag represents data according to the data category and the name and comprises a start symbol, a data category, a separator, a name and an end symbol; the three-dimensional tag represents data according to data type, data category and name, and comprises a start symbol, a data type, a separator, a data category, a name and an end symbol; the one-dimensional label is a simplified mode of a two-dimensional label and is used for representing data commonly used in a program, and comprises a start symbol, a name and an end symbol; the initiator, terminator and separator comprise one or more characters; or the data tag adopts a simplified mode, and omits one or more of a start symbol, an end symbol and a separator; the arrangement sequence of the data category and the name in the tag can be data category and name or name and data category;
The format field is used in a format preservation digital program and is divided into a single field, a double field and a three field according to the number of the fields, one or more of the single field, the double field and the three field are adopted according to requirements, the double field is respectively a data type, a data type and a data name, the data tag is used for representing the data in the single field, and the format preservation refers to adopting a database, xml, json or a self-defined format;
the data category is various data sources in software, and comprises, but is not limited to, constants, custom variables, data entered by an interface, program calling parameters, text files, sql data, json and xml according to different development languages;
for the data labels in the digital program sentences in the parent program, adopting a first function or process to replace the data labels with corresponding actual data values; for a format field in a digital program statement, invoking a first function or a process for a single field to carry out numerical replacement on a data tag in the single field; the second function is called for the double fields to acquire actual data; for the three fields, acquiring actual data according to the category and the name, and converting the actual data from a character string to a specified data type;
The first function or process is used for scanning the data tag in the input character string parameter to acquire actual data, replacing the data tag with the actual data and finally returning result data;
the second function is to obtain the actual data value according to the data category and name, and return the data value.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110909661.6A CN113568607B (en) | 2021-08-09 | 2021-08-09 | Digital program implementation method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110909661.6A CN113568607B (en) | 2021-08-09 | 2021-08-09 | Digital program implementation method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113568607A CN113568607A (en) | 2021-10-29 |
CN113568607B true CN113568607B (en) | 2023-11-07 |
Family
ID=78171088
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110909661.6A Active CN113568607B (en) | 2021-08-09 | 2021-08-09 | Digital program implementation method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113568607B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1485734A (en) * | 2002-08-22 | 2004-03-31 | 国际商业机器公司 | Display apparatus |
CN1841328A (en) * | 2005-04-02 | 2006-10-04 | 华为技术有限公司 | Automata methods for scripting languages |
CN101482847A (en) * | 2009-01-19 | 2009-07-15 | 北京邮电大学 | Detection method based on safety bug defect mode |
CN103077064A (en) * | 2012-12-31 | 2013-05-01 | 北京配天大富精密机械有限公司 | Method and interpretation device for analyzing and executing program language |
CN105446747A (en) * | 2015-12-29 | 2016-03-30 | 江苏图码信息科技有限公司 | Visual three-dimensional code touch screen compiler and programming technique |
CN109542965A (en) * | 2018-11-07 | 2019-03-29 | 平安医疗健康管理股份有限公司 | A kind of data processing method, electronic equipment and storage medium |
CN110825969A (en) * | 2019-11-07 | 2020-02-21 | 腾讯科技(深圳)有限公司 | Data processing method, device, terminal and storage medium |
CN111367938A (en) * | 2020-03-04 | 2020-07-03 | 海南金盘智能科技股份有限公司 | Database instruction generation method and device and computer storage medium |
CN113031932A (en) * | 2021-03-11 | 2021-06-25 | 腾讯科技(深圳)有限公司 | Project development method and device, electronic equipment and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170099144A1 (en) * | 2015-10-06 | 2017-04-06 | Prem Sobel | Embedded encryption platform comprising an algorithmically flexible multiple parameter encryption system |
-
2021
- 2021-08-09 CN CN202110909661.6A patent/CN113568607B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1485734A (en) * | 2002-08-22 | 2004-03-31 | 国际商业机器公司 | Display apparatus |
CN1841328A (en) * | 2005-04-02 | 2006-10-04 | 华为技术有限公司 | Automata methods for scripting languages |
CN101482847A (en) * | 2009-01-19 | 2009-07-15 | 北京邮电大学 | Detection method based on safety bug defect mode |
CN103077064A (en) * | 2012-12-31 | 2013-05-01 | 北京配天大富精密机械有限公司 | Method and interpretation device for analyzing and executing program language |
CN105446747A (en) * | 2015-12-29 | 2016-03-30 | 江苏图码信息科技有限公司 | Visual three-dimensional code touch screen compiler and programming technique |
CN109542965A (en) * | 2018-11-07 | 2019-03-29 | 平安医疗健康管理股份有限公司 | A kind of data processing method, electronic equipment and storage medium |
CN110825969A (en) * | 2019-11-07 | 2020-02-21 | 腾讯科技(深圳)有限公司 | Data processing method, device, terminal and storage medium |
CN111367938A (en) * | 2020-03-04 | 2020-07-03 | 海南金盘智能科技股份有限公司 | Database instruction generation method and device and computer storage medium |
CN113031932A (en) * | 2021-03-11 | 2021-06-25 | 腾讯科技(深圳)有限公司 | Project development method and device, electronic equipment and storage medium |
Non-Patent Citations (3)
Title |
---|
DS18B20数字温度传感器接口程序的时序;黄文力 等;《仪器仪表用户》;第18卷(第6期);99-101 * |
Microprocessors: the engines of the digital age;Steve Furber;《 Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences》;第473卷;2199 * |
基于DSP的全数字控制原动系统仿真器程序及其调试;杜宗林;《中国优秀硕士学位论文全文数据库 工程科技Ⅱ辑》(第12期);C042-199 * |
Also Published As
Publication number | Publication date |
---|---|
CN113568607A (en) | 2021-10-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Fischer et al. | The POE language-based editor project | |
Deursen et al. | Language Prototyping: an algebraic specification approach | |
EP0643851B1 (en) | Debugger program which includes correlation of computer program source code with optimized objet code | |
US4730315A (en) | Diagrammatic method of testing program | |
US11294665B1 (en) | Computerized software version control with a software database and a human database | |
JPS61282935A (en) | Method and apparatus for alloting and inspecting attribute in program | |
CN109491658A (en) | The generation method and device of computer-executable code data | |
CN110837362A (en) | Method, system and editor for editing rule of guide type visual graphic modularization | |
CN118444900A (en) | Application program construction method based on low-code platform and low-code platform | |
JPH11249875A (en) | Method for supporting programming and device therefor | |
CN119690440A (en) | Automatic code activity diagram generation system and method | |
CN113568607B (en) | Digital program implementation method and system | |
KR102614967B1 (en) | Automation system and method for extracting intermediate representation based semantics of javascript | |
Tauscher | Creating and maintaining IFC–Citygml conversion rules | |
JP4724387B2 (en) | Program conversion program, program conversion apparatus, and program conversion method | |
JP4835859B2 (en) | State transition diagram creation device and state transition diagram creation method | |
KR20090011974A (en) | How to Extract Compile Target Files | |
CN110554860B (en) | A construction method and code generation method of a software project natural language programming interface NLI | |
CN111309298B (en) | System for realizing processing tool path programming based on custom format file in numerical control system and processing method thereof | |
CN108170436B (en) | PHP and HTM L code hybrid development method and system | |
KR960003048B1 (en) | Displaying method in software development support system | |
Beckmann et al. | Partial Parsing for Structured Editors | |
Merino et al. | Projecting Textual Languages | |
Nagl et al. | Software specification by graph grammars | |
Bartels | Bridging the worlds of textual and projectional language workbenches |
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 |