Code conversion method and device, low-code designer, and storage medium

By converting domain-specific language models into Vue3 composable API JSX code through a preset core transformation pattern, the problem of low code complexity and low flexibility in low-code platforms is solved, enabling rapid construction of high-quality applications and flexible code management.

CN122195433APending Publication Date: 2026-06-12RICHFIT INFORMATION TECH +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
RICHFIT INFORMATION TECH
Filing Date
2024-12-10
Publication Date
2026-06-12

Smart Images

  • Figure CN122195433A_ABST
    Figure CN122195433A_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a code conversion method and device, a low-code designer and a storage medium, and relates to the fields of computer software and low-code technology. The method comprises the following steps: obtaining a conversion request; wherein the conversion request comprises a domain-specific language model identifier to be converted. According to the conversion request, a domain-specific language model (DSL model) corresponding to the domain-specific language model identifier is obtained; wherein the domain-specific language model represents a page generated by a domain-specific language. A preset core conversion mode is called to perform language conversion processing on the domain-specific language model to obtain target code; wherein the preset core conversion mode is used to convert the domain-specific language model according to preset core conversion rule information. The method is used to reduce the limitations of code in actual application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of computer software and low-code technology, and in particular to a code conversion method, apparatus, low-code designer and storage medium. Background Technology

[0002] Currently, low-code platforms have become a popular development approach in the software development field. They offer a simplified method for application development, enabling non-professional developers to quickly build applications through minimal coding and drag-and-drop operations on a visual interface. Some platforms or systems have already implemented the ability to translate Domain-Specific Languages ​​(DSLs) into code for frameworks like React and Vue.

[0003] In existing technologies, the converted Vue code on these platforms typically adopts an option-based API style format. However, the option-based API style format has some limitations, including: 1. Complexity of configuration objects: Component properties, events, and lifecycles need to be described through configuration objects, which can increase code complexity and difficulty of understanding. 2. Limitations of object properties: Component properties and events usually need to be defined as object properties, making the converted code cumbersome and complex. This may make scenarios with dynamically generated properties or conditional rendering less flexible, leading to greater limitations in subsequent applications. Summary of the Invention

[0004] This application provides a code conversion method, apparatus, low-code designer, and storage medium to reduce the limitations of the converted code in practical applications.

[0005] In a first aspect, embodiments of this application provide a code conversion method, including:

[0006] Obtain a conversion request; wherein the conversion request includes the domain-specific language model identifier to be converted;

[0007] Based on the conversion request, obtain the domain-specific language model corresponding to the domain-specific language model identifier; wherein, the domain-specific language model represents the page generated in the domain-specific language;

[0008] A preset core conversion mode is invoked to perform language conversion processing on the domain-specific language model to obtain target code; wherein, the preset core conversion mode is used to convert the domain-specific language model according to preset core conversion rule information.

[0009] In one possible implementation, the step of invoking a preset core conversion mode to perform language conversion processing on the domain-specific language model to obtain target code includes:

[0010] If the core conversion mode is the running conversion mode, then the preset first solution information is obtained; wherein, the first solution information includes the mapping relationship between the first conversion algorithm and the subtype in the preset core conversion mode;

[0011] The domain-specific language model is parsed and processed to obtain data of various subtypes;

[0012] Based on the mapping relationship in the first solution information, determine the first target conversion algorithm corresponding to each subtype;

[0013] According to the first target conversion algorithm, the data of each subtype in the domain-specific language model are processed by language conversion to obtain the target code.

[0014] In one possible implementation, the step of invoking a preset core conversion mode to perform language conversion processing on the domain-specific language model to obtain target code includes:

[0015] If the core conversion mode is a compilation conversion mode, then a preset second solution information is obtained; wherein, the second solution information includes the mapping relationship between the second conversion algorithm and the subtype in the preset core conversion mode;

[0016] The domain-specific language model is parsed and processed to obtain data of various subtypes;

[0017] Based on the mapping relationship in the second solution information, determine the second target conversion algorithm corresponding to each subtype;

[0018] According to the second target conversion algorithm, the data of each subtype in the domain-specific language model are processed by language conversion to obtain the target code.

[0019] In one possible implementation, the step of performing language conversion processing on the data of each subtype in the domain-specific language model according to the second target conversion algorithm to obtain the target code includes:

[0020] The domain-specific language model is optimized according to a preset optimization algorithm to obtain an optimized domain-specific language model.

[0021] According to the second target conversion algorithm, language conversion processing is performed on the data of each subtype in the optimized domain-specific language model to obtain the target code.

[0022] In one possible implementation, after performing language conversion processing on the data of each subtype in the optimized domain-specific language model according to the second target conversion algorithm to obtain the target code, the method further includes:

[0023] The target code is formatted to obtain formatted target code.

[0024] In one possible implementation, the method further includes:

[0025] Obtain preset configuration information; wherein, the configuration information includes menu DSL model and routing DSL model;

[0026] The configuration information is converted according to the core conversion mode to obtain the converted configuration information.

[0027] In one possible implementation, the method further includes:

[0028] Store the target code as a target file.

[0029] Secondly, embodiments of this application provide a code conversion apparatus, comprising:

[0030] The first acquisition module is used to acquire a conversion request; wherein, the conversion request includes the domain-specific language model identifier to be converted;

[0031] The second acquisition module is used to acquire a domain-specific language model corresponding to the domain-specific language model identifier according to the conversion request; wherein, the domain-specific language model represents a page generated in a domain-specific language;

[0032] The conversion module is used to call a preset core conversion mode to perform language conversion processing on the domain-specific language model to obtain target code; wherein, the preset core conversion mode is used to convert the domain-specific language model according to preset core conversion rule information.

[0033] In one possible implementation, the conversion module is specifically used for:

[0034] If the core conversion mode is the running conversion mode, then the preset first solution information is obtained; wherein, the first solution information includes the mapping relationship between the first conversion algorithm and the subtype in the preset core conversion mode;

[0035] The domain-specific language model is parsed and processed to obtain data of various subtypes;

[0036] Based on the mapping relationship in the first solution information, determine the first target conversion algorithm corresponding to each subtype;

[0037] According to the first target conversion algorithm, the data of each subtype in the domain-specific language model are processed by language conversion to obtain the target code.

[0038] In one possible implementation, the conversion module includes:

[0039] The first acquisition unit is configured to acquire preset second solution information if the core conversion mode is a compilation conversion mode; wherein the second solution information includes the mapping relationship between the second conversion algorithm and the subtype in the preset core conversion mode;

[0040] The second acquisition unit is used to parse and process the domain-specific language model to obtain data of each subtype;

[0041] The first determining unit is used to determine the second target conversion algorithm corresponding to each subtype based on the mapping relationship in the second solution information;

[0042] The conversion unit is used to perform language conversion processing on the data of each subtype in the domain-specific language model according to the second target conversion algorithm to obtain the target code.

[0043] In one possible implementation, the conversion unit is specifically used for:

[0044] The domain-specific language model is optimized according to a preset optimization algorithm to obtain an optimized domain-specific language model.

[0045] According to the second target conversion algorithm, language conversion processing is performed on the data of each subtype in the optimized domain-specific language model to obtain the target code.

[0046] In one possible implementation, the device further includes:

[0047] The formatting unit is used to perform language conversion processing on the data of each subtype in the optimized domain-specific language model according to the second target conversion algorithm to obtain target code, and then to perform formatting processing on the target code to obtain formatted target code.

[0048] In one possible implementation, the device is further specifically used for:

[0049] Obtain preset configuration information; wherein, the configuration information includes menu DSL model and routing DSL model;

[0050] The configuration information is converted according to the core conversion mode to obtain the converted configuration information.

[0051] In one possible implementation, the device is further specifically used for:

[0052] Store the target code as a target file.

[0053] Thirdly, embodiments of this application provide a low-code designer, including: a memory and a processor;

[0054] The memory stores computer-executed instructions;

[0055] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.

[0056] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.

[0057] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.

[0058] The code conversion method, apparatus, low-code designer, and storage medium provided in this application embodiment obtain a conversion request; wherein, the conversion request includes a domain-specific language model identifier to be converted. Based on the conversion request, the domain-specific language model (DSL model) corresponding to the domain-specific language model identifier is obtained; wherein, the domain-specific language model represents a page generated in a domain-specific language. A preset core conversion mode is invoked to perform language conversion processing on the domain-specific language model to obtain target code; wherein, the preset core conversion mode is used to convert the domain-specific language model according to preset core conversion rule information. In this solution, the preset core conversion mode is invoked to perform language conversion processing on the domain-specific language model to obtain target code. Therefore, domain-specific language models (DSL models) can be automatically converted into Vue3's composable API JSX code. Developers do not need to delve into the details of the Vue.js framework to quickly build high-quality applications, avoiding the limitations of option-based API template-style code. The converted target code is fully human-readable Vue3 composable API-style component code, and uses JSX syntax to provide more powerful JavaScript support and type checking, better code reuse and intuitive syntax, as well as richer ecosystem support. It also supports running in a browser environment and supports dynamic conversion of DSL to code at runtime. The generated code can be managed as project assets using Git for convenient version control and conflict management, providing greater flexibility and customization to reduce the limitations of the converted code in practical applications. Attached Figure Description

[0059] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0060] Figure 1 A flowchart illustrating a code conversion method provided in this application embodiment. Figure 1 ;

[0061] Figure 2 A flowchart illustrating another code conversion method provided in this application embodiment. Figure 2 ;

[0062] Figure 3 A schematic diagram of the architecture of a code conversion method provided in this application;

[0063] Figure 4 This is a schematic diagram of the structure of a code conversion device provided in an embodiment of this application;

[0064] Figure 5This is a schematic diagram of another code conversion device provided in an embodiment of this application;

[0065] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0066] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0067] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0068] Currently, low-code platforms have become a popular development approach in the software development field. They offer a simplified method for application development, enabling non-professional developers to quickly build applications through minimal coding and drag-and-drop operations on a visual interface. Some platforms or systems have already implemented the ability to translate Domain-Specific Languages ​​(DSLs) into code for frameworks like React and Vue.

[0069] In one example, on these platforms, the converted Vue code typically uses an options-based API style. However, options-based API style code has some limitations, including: 1. Complexity of configuration objects: Component properties, events, and lifecycles need to be described through configuration objects, which can increase code complexity and difficulty of understanding. 2. Limitations of object properties: Component properties and events usually need to be defined as object properties, making the converted code more cumbersome and complex. This may make scenarios with dynamically generated properties or conditional rendering less flexible, leading to greater limitations in subsequent applications.

[0070] Based on the above scenarios, it can be seen that in the existing technology, the conversion code is relatively cumbersome and complex, which may make some scenarios with dynamically generated attributes or conditional rendering less flexible, thus leading to the technical problem that the conversion code has high limitations in subsequent applications.

[0071] The code conversion method provided in this application can automatically convert domain-specific language models (i.e., DSL models) into Vue3 composable API JSX code. Developers can quickly build high-quality applications without having to learn the details of the Vue.js framework, avoiding the limitations of option-based API template-style code. The converted target code is fully human-readable Vue3 composable API-style component code, and uses JSX syntax to provide more powerful JavaScript support and type checking, better code reuse and intuitive syntax, as well as richer ecosystem support. It also supports running in a browser environment and supports dynamic conversion of DSL to code at runtime. The generated code can be managed as a project asset using Git for convenient version control and conflict management, providing greater flexibility and customization, and solving the technical problem of the high limitation of converted code in practical applications.

[0072] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0073] Figure 1 A flowchart illustrating a code conversion method provided in this application. Figure 1 ,like Figure 1 As shown, the method includes:

[0074] S101. Obtain the conversion request; wherein, the conversion request includes the domain-specific language model identifier to be converted.

[0075] For example, the executing entity of this embodiment can be a low-code designer, a terminal device, a code conversion device, or other device or apparatus capable of executing this embodiment, and there are no limitations on this. In this embodiment, a low-code designer is used as the executing entity.

[0076] First, the low-code designer represents a development platform used to develop low-code applications. The execution entity is the subsystem within the low-code designer that transforms the code. It needs to obtain a transformation request; this request includes a domain-specific language model identifier to be transformed. This domain-specific language model identifier is used to obtain the corresponding domain-specific language model, which represents the page generated by the user using a domain-specific language on the low-code designer.

[0077] S102. Based on the conversion request, obtain the domain-specific language model corresponding to the domain-specific language model identifier; wherein, the domain-specific language model represents the page generated in the domain-specific language.

[0078] For example, based on the conversion request, a domain-specific language model corresponding to the domain-specific language model identifier is obtained, and the domain-specific language model represents the page generated in the domain-specific language.

[0079] S103. Call the preset core conversion mode to perform language conversion processing on the domain-specific language model to obtain the target code; wherein, the preset core conversion mode is used to convert the domain-specific language model according to the preset core conversion rule information.

[0080] For example, the preset core transformation mode is used to transform the domain-specific language model according to the preset core transformation rule information to obtain the Vue3 composite API JSX code. The core transformation mode includes a runtime transformation mode and a compilation transformation mode. The runtime transformation mode means that the domain-specific language model is transformed and displayed in the browser; the compilation transformation mode means that the domain-specific language model is transformed during the compilation process.

[0081] In this step, the preset runtime conversion mode and / or compilation conversion mode are invoked to perform language conversion processing on the domain-specific language model to obtain the target code.

[0082] The code conversion method provided in this application embodiment obtains a conversion request, wherein the conversion request includes a domain-specific language model identifier to be converted. Based on the conversion request, the domain-specific language model (DSL model) corresponding to the domain-specific language model identifier is obtained; wherein the domain-specific language model represents a page generated in a domain-specific language. A preset core conversion mode is invoked to perform language conversion processing on the domain-specific language model to obtain the target code; wherein the preset core conversion mode is used to convert the domain-specific language model according to preset core conversion rule information. In this solution, the preset core conversion mode is invoked to perform language conversion processing on the domain-specific language model to obtain the target code. Therefore, domain-specific language models (DSL models) can be automatically converted into Vue3's composable API JSX code. Developers do not need to delve into the details of the Vue.js framework to quickly build high-quality applications, avoiding the limitations of option-based API template-style code. The converted target code is fully human-readable Vue3 composable API-style component code, and uses JSX syntax to provide more powerful JavaScript support and type checking, better code reuse and intuitive syntax, as well as richer ecosystem support. It also supports running in a browser environment and supports dynamic conversion of DSL to code at runtime. The generated code can be managed as project assets using Git for convenient version control and conflict management, providing greater flexibility and customization to reduce the limitations of the converted code in practical applications.

[0083] Figure 2 A flowchart illustrating a code conversion method provided in this application. Figure 2 ,like Figure 2 As shown, in this embodiment... Figure 1 Based on the examples, the code conversion method is described in detail, which includes:

[0084] S201. Obtain the conversion request; wherein, the conversion request includes the domain-specific language model identifier to be converted.

[0085] For example, this step can be referred to Figure 1 Step 101 in the text will not be repeated here.

[0086] S202. Based on the conversion request, obtain the domain-specific language model corresponding to the domain-specific language model identifier; wherein, the domain-specific language model represents the page generated in the domain-specific language.

[0087] For example, this step can be referred to Figure 1 Step 102 in the text will not be repeated here.

[0088] S203. Call the preset core conversion mode to perform language conversion processing on the domain-specific language model to obtain the target code; wherein, the preset core conversion mode is used to convert the domain-specific language model according to the preset core conversion rule information.

[0089] Step 203 includes two implementation methods:

[0090] The first implementation of step 203 is as follows: If the core conversion mode is the running conversion mode, then obtain the preset first solution information; wherein, the first solution information includes the mapping relationship between the first conversion algorithm and the subtype in the preset core conversion mode; parse the domain-specific language model to obtain the data of each subtype; determine the first target conversion algorithm corresponding to each subtype according to the mapping relationship in the first solution information; perform language conversion processing on the data of each subtype in the domain-specific language model according to the first target conversion algorithm to obtain the target code.

[0091] The second implementation of step 203: If the core conversion mode is a compilation conversion mode, then obtain the preset second solution information; wherein, the second solution information includes the mapping relationship between the second conversion algorithm and the subtype in the preset core conversion mode; parse the domain-specific language model to obtain the data of each subtype; determine the second target conversion algorithm corresponding to each subtype according to the mapping relationship in the second solution information; perform language conversion processing on the data of each subtype in the domain-specific language model according to the second target conversion algorithm to obtain the target code.

[0092] In one example, "According to the second target conversion algorithm, the data of each subtype in the domain-specific language model are processed for language conversion to obtain the target code" includes: optimizing the domain-specific language model according to the preset optimization algorithm to obtain the optimized domain-specific language model; and performing language conversion processing on the data of each subtype in the optimized domain-specific language model according to the second target conversion algorithm to obtain the target code.

[0093] In one example, after performing language conversion processing on the data of each subtype in the optimized domain-specific language model according to the second target conversion algorithm to obtain the target code, the method also includes: formatting the target code to obtain formatted target code.

[0094] In one example, the second implementation also includes: obtaining preset configuration information; wherein the configuration information includes a menu DSL model and a routing DSL model; and converting the configuration information according to the core conversion mode to obtain the converted configuration information.

[0095] For example, a preset core conversion mode is used to convert a domain-specific language model according to preset core conversion rule information. The core conversion mode includes a runtime conversion mode and a compilation conversion mode. The runtime conversion mode indicates that the domain-specific language model is converted and displayed in a browser; the compilation conversion mode indicates that the domain-specific language model is converted during the compilation process. In this step, the preset runtime conversion mode and / or compilation conversion mode can be invoked to perform language conversion processing on the domain-specific language model to obtain the target code.

[0096] Figure 3 A schematic diagram of the architecture of a code conversion method provided in this application is shown below. Figure 3 As shown, it includes the S1 runtime module, the S2 compilation module, and the S3 core module. S3 includes the conversion algorithm. S1 can call the conversion algorithm in S3 to convert the domain-specific language model, and S2 can also call the conversion algorithm in S3 to convert the domain-specific language model. The S3 core module is responsible for converting the DSL model into target code.

[0097] The S1 runtime module includes S11 (compileCode) and S12 (Solution). The S2 compilation module includes S21 (compileMenu), S22 (compileRouter), S23 (compileModel), S24 (pre-optimization), S25 (post-optimization), and S26 (Solution). The S2 compilation module converts the project menu, routes, and other preset configuration information in the designer, as well as the DSL model, into corresponding human-readable target code, enabling the project application to directly start the DEV service or package and deploy using the vite tool. S21 (compileMenu) is responsible for converting the received menu DSL model into a code project framework usable by the project. S22 (compileRouter) is responsible for... The project's DSL routing model is converted into corresponding routing configuration code usable by vueRouter. S23 (compileModel) is the externally provided conversion method for the DSL model. This method calls the conversion algorithm in the S3 core module. The calling logic is as follows: first, the DSL model undergoes pre-optimization in S34; then, the DSL model is converted according to S26 (Solution) to obtain the converted target code; finally, the target code undergoes post-optimization in S25. S24 (pre-optimization) mainly analyzes and optimizes the DSL model, such as deleting useless descriptions, anonymous functions, and optimizing the code. The optimization operations are not limited, aiming to make the target code clear and easy to understand. S25 (post-optimization) mainly performs operations such as formatting on the converted target code; this operation is not limited. S26 (Solution) provides a conversion scheme for each DSL type in the compilation environment, corresponding one-to-one with the types in S23. That is, the solution information includes the mapping relationship between the conversion algorithm in the preset core conversion mode and the subtypes in the DSL model. Therefore, S26 (Solution) can be used to call the target conversion algorithm corresponding to the subtype for conversion. The S3 core module includes S31 (generateCore) and S32 (type). S31 (generateCore) is the core conversion algorithm, which is the conversion function that converts the DSL model into executable code. It receives two parameters: the DSL model and the conversion scheme (Solution), performs the conversion according to the two parameters, and returns the converted target code. S32 (type) includes the conversion algorithm described for each subtype in the corresponding DSL model.

[0098] In the first implementation, if the core conversion mode is the runtime conversion mode, then in the S1 runtime module, the first solution information S12 in the S3 core module is called via S11. The first solution information S12 includes the mapping relationship between the first conversion algorithm and subtypes in the preset core conversion mode. The domain-specific language model is parsed to obtain data for each subtype, and the first target conversion algorithm corresponding to each subtype is determined according to the mapping relationship in the first solution information. The first target conversion algorithm in the S3 core module is called via S11, and language conversion processing is performed on the data of each subtype in the domain-specific language model according to the first target conversion algorithm to obtain the target code.

[0099] In the second implementation: If the core conversion mode is a compilation conversion mode, then in the S2 compilation module, firstly, the preset second solution information S26 is called via S23. The second solution information S26 includes the mapping relationship between the second conversion algorithm and subtypes in the preset core conversion mode. The domain-specific language model is parsed to obtain data for each subtype, and the second target conversion algorithm corresponding to each subtype is determined based on the mapping relationship in the second solution information. Then, the second target conversion algorithm in the S3 core module is called via S26, and language conversion processing is performed on the data of each subtype in the domain-specific language model according to the second target conversion algorithm to obtain the target code.

[0100] Furthermore, before performing language conversion on the domain-specific language model, pre-optimization in S24 is required. This involves optimizing the domain-specific language model according to a preset optimization algorithm to obtain an optimized domain-specific language model. Then, according to the second target conversion algorithm, language conversion processing is performed on the data of each subtype in the optimized domain-specific language model to obtain the target code. Finally, post-optimization in S25 is performed, which involves formatting the target code to obtain formatted target code.

[0101] Furthermore, in the S2 compilation module, it is also necessary to obtain the menu DSL model through S21 (compileMenu) and the routing DSL model through S22 (compileRouter). Then, according to the core conversion mode, the menu DSL model and the routing DSL model are converted to obtain the converted configuration information.

[0102] For example, the S2 compilation module is used by the low-code designer for publishing functionality. When the user clicks the publish button, the low-code designer calls the compileModel function, passing in the DSL model to be converted and a predefined Solution object. Then, the generateCore core conversion function in S3 is responsible for converting the DSL model and returning the JSX code, which is the Vue3 composable API.JSX target code.

[0103] Therefore, in the first implementation, the target code that can be directly rendered is obtained directly in the browser by calling the runtime module, and the page represented by the target code is rendered and displayed by calling the preset rendering function. In the second implementation, the code converted by calling the compileModel function in the compilation module is fully human-readable Vue3 composable API style component code, and generates code for routes, menus, pages, components, etc. for the front-end project. It also provides more powerful JavaScript support and type checking, better code reuse and intuitive syntax, and richer ecosystem support by using JSX syntax.

[0104] S204. Save the target code as an object file.

[0105] For example, since the DSL model is also managed using git along with the project, and the DSL model is in JSON format, it can be analyzed and conflicts can be managed using git through the corresponding program. Therefore, the target code can be stored as a target file for easy use in various scenarios and projects.

[0106] The code conversion method provided in this application includes obtaining a conversion request, wherein the conversion request includes an identifier of a domain-specific language model to be converted. Based on the conversion request, the domain-specific language model corresponding to the domain-specific language model identifier is obtained; wherein the domain-specific language model represents a page generated in a domain-specific language. A preset core conversion mode is invoked to perform language conversion processing on the domain-specific language model to obtain target code; wherein the preset core conversion mode is used to convert the domain-specific language model according to preset core conversion rule information. The target code is stored as a target file. Therefore, domain-specific language models (DSL models) can be automatically converted into Vue3's composable API JSX code. Developers do not need to delve into the details of the Vue.js framework to quickly build high-quality applications, avoiding the limitations of option-based API template-style code. The converted target code is fully human-readable Vue3 composable API-style component code, and uses JSX syntax to provide more powerful JavaScript support and type checking, better code reuse and intuitive syntax, as well as richer ecosystem support. It also supports running in a browser environment and supports dynamic conversion of DSL to code at runtime. The generated code can be managed as project assets using Git for convenient version control and conflict management, providing greater flexibility and customization to reduce the limitations of the converted code in practical applications.

[0107] Figure 4 A schematic diagram of the structure of a code conversion device provided in this application is shown below. Figure 4 As shown, the code conversion device 30 provided in this embodiment includes:

[0108] The first acquisition module 31 is used to acquire a conversion request; wherein the conversion request includes the domain-specific language model identifier to be converted.

[0109] The second acquisition module 32 is used to acquire the domain-specific language model corresponding to the domain-specific language model identifier according to the conversion request; wherein, the domain-specific language model represents the page generated in the domain-specific language.

[0110] The conversion module 33 is used to call a preset core conversion mode to perform language conversion processing on the domain-specific language model to obtain the target code; wherein, the preset core conversion mode is used to convert the domain-specific language model according to the preset core conversion rule information.

[0111] Figure 5 This is a schematic diagram of another code conversion device provided in an embodiment of this application. Figure 4 Based on the illustrated embodiments, as Figure 5 As shown, conversion module 33 is specifically used for:

[0112] If the core conversion mode is the running conversion mode, then the preset first solution information is obtained; wherein, the first solution information includes the mapping relationship between the first conversion algorithm and the subtype in the preset core conversion mode.

[0113] The domain-specific language model is parsed and processed to obtain data of various subtypes.

[0114] Based on the mapping relationship in the first solution information, determine the first target conversion algorithm corresponding to each subtype.

[0115] Based on the first target conversion algorithm, language conversion processing is performed on the data of each subtype in the domain-specific language model to obtain the target code.

[0116] In one possible implementation, the conversion module 33 includes:

[0117] The first acquisition unit 331 is used to acquire preset second solution information if the core conversion mode is a compilation conversion mode; wherein, the second solution information includes the mapping relationship between the second conversion algorithm and the subtype in the preset core conversion mode.

[0118] The second acquisition unit 332 is used to parse and process the domain-specific language model to obtain data of various subtypes.

[0119] The first determining unit 333 is used to determine the second target conversion algorithm corresponding to each subtype based on the mapping relationship in the second solution information.

[0120] The conversion unit 334 is used to perform language conversion processing on the data of each subtype in the domain-specific language model according to the second target conversion algorithm to obtain the target code.

[0121] In one possible implementation, the conversion unit 334 is specifically used for:

[0122] Based on a preset optimization algorithm, the domain-specific language model is optimized to obtain an optimized domain-specific language model.

[0123] Based on the second target conversion algorithm, language conversion processing is performed on the data of each subtype in the optimized domain-specific language model to obtain the target code.

[0124] In one possible implementation, the device further includes:

[0125] The formatting unit 335 is used to perform language conversion processing on the data of each subtype in the optimized domain-specific language model according to the second target conversion algorithm to obtain the target code, and then to perform formatting processing on the target code to obtain the formatted target code.

[0126] In one possible implementation, the device is also specifically used for:

[0127] Obtain the preset configuration information; the configuration information includes the menu DSL model and the routing DSL model.

[0128] The configuration information is transformed according to the core transformation mode to obtain the transformed configuration information.

[0129] In one possible implementation, the device is also specifically used for:

[0130] Store the target code as an object file.

[0131] The apparatus provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0132] Figure 6 A schematic diagram of the low-code designer provided in this application. Figure 6 As shown, the low-code designer 40 provided in this embodiment includes at least one processor 401 and a memory 402. Optionally, the device 40 also includes a communication component 403. The processor 401, memory 402, and communication component 403 are connected via a bus 404.

[0133] In a specific implementation, at least one processor 401 executes computer execution instructions stored in memory 402, causing at least one processor 401 to perform the above-described method.

[0134] The specific implementation process of processor 401 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0135] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0136] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.

[0137] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0138] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0139] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.

[0140] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0141] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.

[0142] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0143] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0144] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0145] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0146] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0147] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. A code conversion method, characterized in that, include: Obtain a conversion request; wherein the conversion request includes the domain-specific language model identifier to be converted; Based on the conversion request, obtain the domain-specific language model corresponding to the domain-specific language model identifier; wherein, the domain-specific language model represents the page generated in the domain-specific language; A preset core conversion mode is invoked to perform language conversion processing on the domain-specific language model to obtain target code; wherein, the preset core conversion mode is used to convert the domain-specific language model according to preset core conversion rule information.

2. The method according to claim 1, characterized in that, The process of invoking a preset core conversion mode to perform language conversion processing on the domain-specific language model to obtain target code includes: If the core conversion mode is the running conversion mode, then the preset first solution information is obtained; wherein, the first solution information includes the mapping relationship between the first conversion algorithm and the subtype in the preset core conversion mode; The domain-specific language model is parsed and processed to obtain data of various subtypes; Based on the mapping relationship in the first solution information, determine the first target conversion algorithm corresponding to each subtype; According to the first target conversion algorithm, the data of each subtype in the domain-specific language model are processed by language conversion to obtain the target code.

3. The method according to claim 1, characterized in that, The process of invoking a preset core conversion mode to perform language conversion processing on the domain-specific language model to obtain target code includes: If the core conversion mode is a compilation conversion mode, then a preset second solution information is obtained; wherein, the second solution information includes the mapping relationship between the second conversion algorithm and the subtype in the preset core conversion mode; The domain-specific language model is parsed and processed to obtain data of various subtypes; Based on the mapping relationship in the second solution information, determine the second target conversion algorithm corresponding to each subtype; According to the second target conversion algorithm, the data of each subtype in the domain-specific language model are processed by language conversion to obtain the target code.

4. The method according to claim 3, characterized in that, The step of performing language conversion processing on the data of each subtype in the domain-specific language model according to the second target conversion algorithm to obtain target code includes: The domain-specific language model is optimized according to a preset optimization algorithm to obtain an optimized domain-specific language model. According to the second target conversion algorithm, language conversion processing is performed on the data of each subtype in the optimized domain-specific language model to obtain the target code.

5. The method according to claim 4, characterized in that, After performing language conversion processing on the data of each subtype in the optimized domain-specific language model according to the second target conversion algorithm to obtain the target code, the method further includes: The target code is formatted to obtain formatted target code.

6. The method according to any one of claims 3-5, characterized in that, The method further includes: Obtain preset configuration information; wherein, the configuration information includes menu DSL model and routing DSL model; The configuration information is converted according to the core conversion mode to obtain the converted configuration information.

7. The method according to any one of claims 1-5, characterized in that, The method further includes: Store the target code as a target file.

8. A code conversion device, characterized in that, include: The first acquisition module is used to acquire a conversion request; wherein, the conversion request includes the domain-specific language model identifier to be converted; The second acquisition module is used to acquire a domain-specific language model corresponding to the domain-specific language model identifier according to the conversion request; wherein, the domain-specific language model represents a page generated in a domain-specific language; The conversion module is used to call a preset core conversion mode to perform language conversion processing on the domain-specific language model to obtain target code; wherein, the preset core conversion mode is used to convert the domain-specific language model according to preset core conversion rule information.

9. A low-code designer, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-7.