CN114090012A - TSX file generation method, system, device and medium based on DSL - Google Patents
TSX file generation method, system, device and medium based on DSL Download PDFInfo
- Publication number
- CN114090012A CN114090012A CN202111394643.5A CN202111394643A CN114090012A CN 114090012 A CN114090012 A CN 114090012A CN 202111394643 A CN202111394643 A CN 202111394643A CN 114090012 A CN114090012 A CN 114090012A
- Authority
- CN
- China
- Prior art keywords
- transcoding
- page information
- attribute
- tsx
- event action
- 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.)
- Pending
Links
Images
Classifications
-
- 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
- G06F8/42—Syntactic analysis
- G06F8/427—Parsing
-
- 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/38—Creation or generation of source code for implementing user interfaces
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Stored Programmes (AREA)
Abstract
The invention relates to the technical field of computers, in particular to a method, a system, equipment and a medium for generating a TSX file based on DSL, which comprises the following steps: analyzing and transcoding the page information to obtain page information transcoding, and obtaining component transcoding according to the page information transcoding; transcoding according to the components to obtain event action transcoding, and transcoding according to the event action to obtain a corresponding expression; performing data transcoding on the attribute region of the component transcoding to obtain attribute transcoding, and acquiring a corresponding expression according to the attribute transcoding; carrying out data transcoding on the obtained expression to obtain expression transcoding; integrating data of page information transcoding, attribute transcoding, event action transcoding and expression transcoding to generate a TSX file; the method solves the problems that the front end and the back end of the existing development technology are not separated, the front end code of the server is relatively redundant, and the secondary development of the page cannot be carried out.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, a system, a device, and a medium for generating a TSX file based on DSL.
Background
In the prior art, two processing methods are generally adopted for a developer to generate a front-end page file: the first one is to combine the page configuration data with the page template, that is, the back end generates the page template, and the front end writes the page template according to the pressing configuration data to generate the executable front end page file; the second method is that JSON data is directly generated at a configuration end, a set of general front-end page codes are generated at a server end, and the JSON data is read during operation.
However, the front end and the back end of the first processing method are not separated, the front end code of the server is relatively redundant due to the second processing method, and both the two processing methods have the problem that the secondary development of the page cannot be performed, so that a method for simply and quickly realizing the secondary development of the page on the basis of the separation of the front end and the back end is provided, and the technical problem to be solved is urgently needed.
Disclosure of Invention
The invention provides a method, a system, equipment and a medium for generating a DSL-based TSX file, and solves the technical problems that the front end and the back end of the existing development technology are not separated, the front end code of a server is relatively redundant, and secondary development of a page cannot be carried out.
In order to solve the technical problems, the invention provides a method, a system, equipment and a medium for generating a TSX file based on DSL.
In a first aspect, the present invention provides a method for generating a TSX file based on DSL, where the method includes the following steps:
acquiring page information of a front-end DSL code;
analyzing and transcoding the page information by using a DSL analyzer to obtain page information transcoding, and transcoding according to the page information to obtain component transcoding;
judging whether an event action exists according to the component transcoding, if so, performing data transcoding on the event action to obtain an event action transcoding, judging whether an expression exists according to the event action transcoding, and if so, acquiring a corresponding expression;
performing data transcoding on the attribute region transcoded by the component to obtain attribute transcoding, judging whether an expression exists according to the attribute transcoding, and if the expression exists, acquiring a corresponding expression;
carrying out data transcoding on the obtained expression to obtain expression transcoding;
and integrating the page information transcoding, the attribute transcoding, the event action transcoding and the expression transcoding to generate a TSX file.
In a further embodiment, when it is determined that there is no corresponding expression according to the event action transcoding, performing data integration on the page information transcoding, the attribute transcoding and the event action transcoding to generate a TSX file.
In a further implementation scheme, when an event action is judged to exist according to the component transcoding and no corresponding expression is judged to exist according to the attribute transcoding, the page information transcoding, the attribute transcoding and the event action transcoding are subjected to data integration to generate a TSX file.
In further embodiments, the event actions include component events and page configuration actions.
In further embodiments, the method further comprises: and processing the TSX file by using a Webpack tool to obtain an executable JS file.
In a second aspect, the present invention provides a DSL-based TSX file generation system, comprising:
the system comprises a page information acquisition module, a page information acquisition module and a page information acquisition module, wherein the page information acquisition module is used for acquiring page information of a front-end DSL code;
the page information transcoding module is used for analyzing and transcoding the page information by using a DSL analyzer to obtain page information transcoding and transcoding according to the page information to obtain component transcoding;
the event action transcoding module is used for judging whether an event action exists according to the component transcoding, if so, carrying out data transcoding on the event action to obtain event action transcoding, judging whether an expression exists according to the event action transcoding, and if so, acquiring a corresponding expression;
the attribute transcoding module is used for carrying out data transcoding on the attribute region transcoded by the component to obtain attribute transcoding, judging whether an expression exists according to the attribute transcoding, and if the expression exists, acquiring a corresponding expression;
the expression transcoding module is used for transcoding the data of the obtained expression to obtain expression transcoding;
and the data integration module is used for integrating the page information transcoding, the attribute transcoding, the event action transcoding and the expression transcoding to generate a TSX file.
In a further embodiment, the data integration module is further configured to perform data integration on the page information transcoding, the attribute transcoding and the event action transcoding to generate a TSX file when the event action transcoding module determines that there is no corresponding expression according to the event action transcoding.
In a further embodiment, the data integration module is further configured to integrate the page information transcoding, the attribute transcoding, and the event action transcoding to generate a TSX file, when the event action transcoding module determines that an event action is present according to the component transcoding, and the attribute transcoding module determines that no corresponding expression is present according to the attribute transcoding.
In a third aspect, the present invention further provides a computer device, including a processor and a memory, where the processor is connected to the memory, the memory is used for storing a computer program, and the processor is used for executing the computer program stored in the memory, so that the computer device executes the steps for implementing the method.
In a fourth aspect, the present invention also provides a computer-readable storage medium, in which a computer program is stored, which computer program, when executed by a processor, implements the steps of the above method.
The invention provides a method, a system, equipment and a medium for generating a DSL-based TSX file, wherein the method is characterized in that on the basis of separating a front end from a back end, a DSL analyzer is used for analyzing and transcoding page information of front-end DSL code data to generate a re-editable TSX file, and secondary development can be carried out. Compared with the prior art, the method forms a certain transcoding rule through page information transcoding, attribute transcoding, event action transcoding and expression transcoding, enables developers to carry out secondary development from a code level, is convenient to operate, simplifies the development process of the developers, and improves the development efficiency.
Drawings
Fig. 1 is a schematic flow chart of a DSL-based TSX file generation method according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a TSX file generation process provided by an embodiment of the present invention;
fig. 3 is a block diagram of a DSL-based TSX file generation system according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The embodiments of the present invention will be described in detail below with reference to the accompanying drawings, which are given solely for the purpose of illustration and are not to be construed as limitations of the invention, including the drawings which are incorporated herein by reference and for illustration only and are not to be construed as limitations of the invention, since many variations thereof are possible without departing from the spirit and scope of the invention.
Referring to fig. 1, an embodiment of the present invention provides a method for generating a DSL-based TSX file, where as shown in fig. 1, the method includes the following steps:
s1, acquiring page information of a front-end DSL code.
And S2, analyzing and transcoding the page information by using a DSL analyzer to obtain page information transcoding, and transcoding according to the page information to obtain component transcoding.
In this embodiment, the DSL parser is mainly responsible for transcoding the DSL parsed into the TSX file, and this embodiment parses and transcodes the page information of the front-end DSL code, for example: api data, socket data, page variables, etc.
And S3, judging whether an event action exists or not according to the component transcoding, if so, carrying out data transcoding on the event action to obtain event action transcoding, judging whether an expression exists or not according to the event action transcoding, and if so, acquiring the corresponding expression.
And S4, performing data transcoding on the attribute region transcoded by the component to obtain attribute transcoding, judging whether an expression exists according to the attribute transcoding, and if the expression exists, acquiring a corresponding expression.
And S5, carrying out data transcoding on the obtained expression to obtain expression transcoding.
And S6, carrying out data integration on the page information transcoding, the attribute transcoding, the event action transcoding and the expression transcoding to generate a TSX file.
In one embodiment, the event actions include component events and page configuration actions.
The embodiment forms a certain transcoding logic by analyzing and transcoding the page information of the dsl, performing data transcoding on the attribute region of component transcoding, performing data transcoding on the part using the expression, transcoding the component event and transcoding the page configuration action, and simultaneously can allow developers to perform secondary development from the code level, thereby meeting the requirement of secondary development of users, saving the cost and improving the efficiency.
In one embodiment, as shown in fig. 2, when it is determined that there is no corresponding expression according to the event action transcoding, data integration is performed on the page information transcoding, the attribute transcoding, and the event action transcoding, so as to generate a TSX file.
In one embodiment, when an event action is judged to exist according to the component transcoding and no corresponding expression is judged to exist according to the attribute transcoding, the page information transcoding, the attribute transcoding and the event action transcoding are subjected to data integration to generate a TSX file.
In an embodiment, a method for generating a DSL-based TSX file provided in this embodiment further includes: and processing the TSX file by using a Webpack tool to obtain an executable JS file.
The TSX file generated by the embodiment can be developed secondarily, the executable JS file can be generated by using the Webpack technology, and by the technical scheme provided by the embodiment of the invention, developers can conveniently and quickly develop secondarily, so that the labor development cost is reduced.
In this embodiment, on the basis of front-end and back-end separation, the DSL parser is used to parse the front-end DSL code to generate a re-editable TSX file, so that developers can perform secondary development on the basis of a code level, thereby implementing control logic for parsing the DSL code and transcoding, greatly improving development flexibility, and achieving the purpose of reducing development cost. Compared with the prior art, the technical scheme of the invention can enable developers to develop codes for the second time, thereby facilitating subsequent development and maintenance and improving the development efficiency.
It should be noted that, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by the function and the inherent logic of the process, and should not constitute any limitation to the implementation process of the embodiment of the present application.
In one embodiment, as shown in fig. 3, an embodiment of the present invention provides a DSL-based TSX file generation system, where the system includes:
a page information obtaining module 101, configured to obtain page information of a front-end DSL code;
the page information transcoding module 102 is configured to analyze and transcode the page information by using a DSL analyzer to obtain a page information transcoding, and transcode the page information according to the page information to obtain a component transcoding;
the event action transcoding module 103 is used for judging whether an event action exists according to the component transcoding, if so, performing data transcoding on the event action to obtain event action transcoding, judging whether an expression exists according to the event action transcoding, and if so, acquiring a corresponding expression;
the attribute transcoding module 104 is configured to perform data transcoding on the attribute region transcoded by the component to obtain attribute transcoding, determine whether an expression exists according to the attribute transcoding, and if the expression exists, obtain a corresponding expression;
the expression transcoding module 105 is used for transcoding data of the obtained expression to obtain expression transcoding;
and the data integration module 106 is used for performing data integration on the page information transcoding, the attribute transcoding, the event action transcoding and the expression transcoding to generate a TSX file.
In an embodiment, the data integration module is further configured to, when the event action transcoding module determines that there is no corresponding expression according to the event action transcoding, perform data integration on the page information transcoding, the attribute transcoding, and the event action transcoding, and generate a TSX file.
In one embodiment, the data integration module is further configured to integrate the page information transcoding, the attribute transcoding, and the event action transcoding to generate a TSX file, when the event action transcoding module determines that there is an event action according to the component transcoding, and the attribute transcoding module determines that there is no corresponding expression according to the attribute transcoding.
For specific limitations of a DSL-based TSX file generation system, reference may be made to the above limitations of a DSL-based TSX file generation method, which are not described herein again. Those of ordinary skill in the art will appreciate that the various modules and steps described in connection with the embodiments disclosed herein may be implemented as hardware, software, or combinations of both. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
According to the TSX file generation system based on the DSL, the technical scheme that the front-end DSL codes are combined with the DSL resolver to generate the re-editable TSX file is realized through the page information transcoding module, the event action transcoding module, the attribute transcoding module, the expression transcoding module and the like, so that a developer can directly develop the codes for the second time, and the TSX file generation system based on the DSL has the characteristics of convenience in use and simplicity in operation; the TSX file generated by the embodiment can be developed secondarily, secondary utilization of codes is realized, reusability of the codes is improved, the development process of a user is simplified, and the development period is shortened.
FIG. 4 is a computer device including a memory, a processor, and a transceiver connected via a bus according to an embodiment of the present invention; the memory is used to store a set of computer program instructions and data and may transmit the stored data to the processor, which may execute the program instructions stored by the memory to perform the steps of the above-described method.
Wherein the memory may comprise volatile memory or non-volatile memory, or may comprise both volatile and non-volatile memory; the processor may be a central processing unit, a microprocessor, an application specific integrated circuit, a programmable logic device, or a combination thereof. By way of example, and not limitation, the programmable logic devices described above may be complex programmable logic devices, field programmable gate arrays, general array logic, or any combination thereof.
In addition, the memory may be a physically separate unit or may be integrated with the processor.
It will be appreciated by those of ordinary skill in the art that the architecture shown in fig. 4 is a block diagram of only a portion of the architecture associated with the present solution and is not intended to limit the computing devices to which the present solution may be applied, and that a particular computing device may include more or less components than those shown, or may combine certain components, or have the same arrangement of components.
In one embodiment, the present invention provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the above-described method.
The embodiment of the invention provides a method, a system, equipment and a medium for generating a TSX file based on DSL, which realizes the technical scheme that the TSX file is obtained by analyzing the DSL through a DSL analyzer, and solves the problems that the front end and the back end of the existing development technology are not separated, the front end code of a server is relatively redundant, and the secondary development of a page cannot be carried out.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, the computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device including one or more available media, such as a magnetic medium (e.g., floppy disks, hard disks, magnetic tapes), an optical medium (e.g., DVDs), or a semiconductor medium (e.g., SSDs), etc.
Those skilled in the art will appreciate that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and the computer program can include the processes of the embodiments of the methods described above when executed.
The above-mentioned embodiments only express some preferred embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for those skilled in the art, various modifications and substitutions can be made without departing from the technical principle of the present invention, and these should be construed as the protection scope of the present application. Therefore, the protection scope of the present patent shall be subject to the protection scope of the claims.
Claims (10)
1. A method for generating a TSX file based on DSL, comprising the steps of:
acquiring page information of a front-end DSL code;
analyzing and transcoding the page information by using a DSL analyzer to obtain page information transcoding, and transcoding according to the page information to obtain component transcoding;
judging whether an event action exists according to the component transcoding, if so, performing data transcoding on the event action to obtain an event action transcoding, judging whether an expression exists according to the event action transcoding, and if so, acquiring a corresponding expression;
performing data transcoding on the attribute region transcoded by the component to obtain attribute transcoding, judging whether an expression exists according to the attribute transcoding, and if the expression exists, acquiring a corresponding expression;
carrying out data transcoding on the obtained expression to obtain expression transcoding;
and integrating the page information transcoding, the attribute transcoding, the event action transcoding and the expression transcoding to generate a TSX file.
2. A DSL-based TSX file generation method as claimed in claim 1, wherein:
and when no corresponding expression is judged according to the event action transcoding, performing data integration on the page information transcoding, the attribute transcoding and the event action transcoding to generate a TSX file.
3. A DSL-based TSX file generation method as claimed in claim 1, wherein:
and when an event action is judged to exist according to the component transcoding and no corresponding expression is judged according to the attribute transcoding, carrying out data integration on the page information transcoding, the attribute transcoding and the event action transcoding to generate a TSX file.
4. A DSL-based TSX file generation method as claimed in claim 1, wherein: the event actions include component events and page configuration actions.
5. The method of DSL-based TSX file generation as claimed in claim 1, further comprising: and processing the TSX file by using a Webpack tool to obtain an executable JS file.
6. A DSL-based TSX file generation system, the system comprising:
the system comprises a page information acquisition module, a page information acquisition module and a page information acquisition module, wherein the page information acquisition module is used for acquiring page information of a front-end DSL code;
the page information transcoding module is used for analyzing and transcoding the page information by using a DSL analyzer to obtain page information transcoding and transcoding according to the page information to obtain component transcoding;
the event action transcoding module is used for judging whether an event action exists according to the component transcoding, if so, carrying out data transcoding on the event action to obtain event action transcoding, judging whether an expression exists according to the event action transcoding, and if so, acquiring a corresponding expression;
the attribute transcoding module is used for carrying out data transcoding on the attribute region transcoded by the component to obtain attribute transcoding, judging whether an expression exists according to the attribute transcoding, and if the expression exists, acquiring a corresponding expression;
the expression transcoding module is used for transcoding the data of the obtained expression to obtain expression transcoding;
and the data integration module is used for integrating the page information transcoding, the attribute transcoding, the event action transcoding and the expression transcoding to generate a TSX file.
7. A DSL-based TSX file generation system as claimed in claim 6, wherein:
and the data integration module is also used for integrating the page information transcoding, the attribute transcoding and the event action transcoding to generate a TSX file when the event action transcoding module judges that no corresponding expression exists according to the event action transcoding.
8. A DSL-based TSX file generation system as claimed in claim 6, wherein:
and the data integration module is also used for integrating the page information transcoding, the attribute transcoding and the event action transcoding to generate a TSX file when the event action transcoding module judges that an event action exists according to the component transcoding and the attribute transcoding module judges that no corresponding expression exists according to the attribute transcoding.
9. A computer device, characterized by: comprising a processor coupled to a memory for storing a computer program and a memory for executing the computer program stored in the memory to cause the computer device to perform the method of any of claims 1 to 5.
10. A computer-readable storage medium characterized by: the computer-readable storage medium has stored thereon a computer program which, when executed, implements the method of any of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111394643.5A CN114090012A (en) | 2021-11-23 | 2021-11-23 | TSX file generation method, system, device and medium based on DSL |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111394643.5A CN114090012A (en) | 2021-11-23 | 2021-11-23 | TSX file generation method, system, device and medium based on DSL |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114090012A true CN114090012A (en) | 2022-02-25 |
Family
ID=80303570
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111394643.5A Pending CN114090012A (en) | 2021-11-23 | 2021-11-23 | TSX file generation method, system, device and medium based on DSL |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114090012A (en) |
-
2021
- 2021-11-23 CN CN202111394643.5A patent/CN114090012A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109002297B (en) | Deployment method, device, equipment and storage medium of consensus mechanism | |
CN107609004B (en) | Application program embedding method and device, computer equipment and storage medium | |
CN113900958A (en) | Test case script generation method, system, medium and electronic device | |
CN115952758B (en) | Chip verification method and device, electronic equipment and storage medium | |
CN111767217B (en) | JS unit test case generation method and device | |
US7752596B2 (en) | Connecting alternative development environment to interpretive runtime engine | |
CN111222636B (en) | Deep learning model conversion method, device, server and storage medium | |
US7716531B2 (en) | System and method for fault mapping of exceptions across programming models | |
CN111026493B (en) | Interface rendering processing method and device | |
CN116360735A (en) | Form generation method, device, equipment and medium | |
CN111046245A (en) | Multi-source heterogeneous data source fusion calculation method, system, equipment and storage medium | |
CN114047970A (en) | Configuration method and system of AUTOSAR (automotive open system architecture) architecture software | |
US20170131980A1 (en) | Model driven architecture for network management and configuration | |
CN113391972A (en) | Interface testing method and device | |
CN113778897A (en) | Automatic test method, device, equipment and storage medium of interface | |
CN107038022B (en) | Deserialization method and deserialization device | |
Bracciali et al. | Systematic component adaptation | |
CN114090012A (en) | TSX file generation method, system, device and medium based on DSL | |
US11797277B2 (en) | Neural network model conversion method server, and storage medium | |
CN111399901B (en) | State enumeration class generation method, device, server and storage medium | |
CN115048913A (en) | Command processing method and device and electronic equipment | |
CN111124378B (en) | Code generation method and device | |
US20090276795A1 (en) | Virtual automata | |
CN114371982A (en) | Simulation test method, device, equipment and readable storage medium | |
EP2690554A2 (en) | A method of operating a system for processing data and a system therefor |
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 |