Native application generation method, device, equipment, storage medium and program product

By parsing domain-specific language texts in the preset parser and generating a syntax structure tree, the performance consumption problem caused by the native application generation method in the prior art parsing DSL text when the application is run, achieving faster application startup time and better operation performance.

CN118916016BActive Publication Date: 2025-03-07SHENZHEN SMARTCITY TECH DEV GRP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411413458.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2025-03-07
Estimated Expiration
2044-10-11

AI Technical Summary

Technical Problem

In the prior art, native application generation methods will parse DSL text when the application runs, resulting in high performance consumption, especially when the application starts up, which significantly increases the startup time.

Method used

By obtaining the domain-specific language text on the user side, parsing the text in the preset parser, generating a syntax structure tree in the target format, and then generating the application code of the native application based on the tree. Finally, using the native application tool chain to build the code to generate the native application.

Benefits of technology

Reduces the performance consumption of native applications at runtime, reduces application startup time, and generates native applications with better running performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916016B_ABST
    Figure CN118916016B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, equipment, storage medium and program product for generating a native application, and relates to the technical field of visual application development. The method discloses a method for generating a native application, including: obtaining a domain-specific language text from a user end, wherein the domain-specific language text includes a special language text for describing a preset application component; parsing the domain-specific language text in a preset parser to obtain a first domain-specific language text, and generating a syntax structure tree in a target format based on the first domain-specific language text; based on the syntax structure tree in the target format, generating application code of a corresponding native application, wherein the native application includes at least one of a web application, a WeChat applet application, an Android application and an Apple application; based on a preset native application tool chain, constructing the application code to generate a native application. The method for generating a native application of the present application can generate a native application with good running performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing development, and in particular to a native application generation method, apparatus, device, storage medium and program product. Background Art

[0002] At present, each end application uses a universal parser to dynamically parse the DSL (Domain-specific language) text when the application is running to generate a native application. Specifically, the universal parser will parse the DSL text when the application is running, generate the interface objects required in the end, and display them on the screen, thereby building a native application suitable for multiple platforms. Compared with directly running the application code of the native application, this method of parsing the DSL text when the application is running adds an additional DSL text parsing step, resulting in unnecessary performance consumption. Especially when the application is started, this parsing process significantly increases the startup time, and as the complexity of the application increases, the startup waiting time will be further extended. In general, the current native application generation method will generate native applications with large running performance consumption, so a better native application generation method is urgently needed.

[0003] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0004] The main purpose of the present application is to provide a native application generation method, device, equipment, storage medium and program product, aiming to solve the technical problem that the current native application generation method will generate native applications with large running performance consumption.

[0005] To achieve the above purpose, the present application proposes a method for generating a native application, the method comprising:

[0006] Acquire a domain-specific language text of the user end, wherein the domain-specific language text includes a special language text for describing a preset application component;

[0007] Parsing the domain-specific language text in a preset parser to obtain a first domain-specific language text, and generating a syntax structure tree in a target format based on the first domain-specific language text;

[0008] Generate application code of a corresponding native application based on the syntax structure tree of the target format, wherein the native application includes at least one of a web application, a WeChat applet application, an Android application, and an Apple application;

[0009] Based on the preset native application tool chain, the application code is built to generate a native application.

[0010] In one embodiment, the step of generating application code of the corresponding native application based on the syntax structure tree of the target format includes:

[0011] Traversing the component nodes of the syntax structure tree, obtaining the hierarchical relationship, style information, and component behavior information of the component nodes, wherein the hierarchical relationship includes the organizational structure of the application component in the native application to be generated, the style information includes the visual attributes of the application component in the native application to be generated, and the component behavior information includes the interaction logic of the application component;

[0012] Generate application code for native applications based on hierarchical relationships, style information, and component behavior information.

[0013] In one embodiment, the native application is a web application, and the steps of generating application code of the native application based on the hierarchical relationship, style information, and component behavior information include:

[0014] Based on the hierarchical relationship, the component hierarchy of the component node is parsed, and the component hierarchy is mapped to a hypertext markup language tag structure corresponding to the web application;

[0015] Based on the style information, the visual attributes of the component nodes are parsed, and the visual attributes are mapped to the cascading style sheet style rules corresponding to the web application;

[0016] Based on the component behavior information, the behavior logic of the component node is analyzed, and the behavior logic is mapped into the script language code corresponding to the web application;

[0017] The HTML tag structure, CSS style rules and scripting language codes of the web application are integrated to obtain the application code of the native application.

[0018] In one embodiment, the native application is a WeChat applet application, and the step of generating the application code of the native application based on the hierarchical relationship, style information, and component behavior information further includes:

[0019] Based on the hierarchical relationship, the component hierarchy of the component node is parsed, and the component hierarchy is mapped to the structural label corresponding to the WeChat Mini Program application;

[0020] Based on the style information, the visual attributes of the component nodes are parsed, and the component nodes are mapped to the style sheet corresponding to the WeChat applet;

[0021] Based on the component behavior information, the behavior logic of the component node is analyzed and the behavior logic is mapped into the script language code corresponding to the WeChat applet;

[0022] Integrate the structural tags, style sheets, and scripting language codes of the WeChat mini-program application to obtain the application code of the native application.

[0023] In one embodiment, the native application is an Android application, and the step of generating application code of the native application based on the hierarchical relationship, style information, and component behavior information further includes:

[0024] Based on the hierarchical relationship, parse the hierarchical structure of the component nodes and map the hierarchical structure to the Android layout file corresponding to the Android application;

[0025] Based on the style information, the visual attributes of the component nodes are parsed, and the visual attributes are mapped to the Android style resources corresponding to the Android application;

[0026] Based on the component behavior information, analyze the behavior logic of the component node and map the behavior logic to the behavior code corresponding to the Android application;

[0027] Integrate layout information, Android style resources, and behavior codes in the Android layout file of the Android application to obtain application code of the native application.

[0028] In one embodiment, the native application is an Apple application, and the step of generating application code of the native application based on the hierarchical relationship, style information, and component behavior information further includes:

[0029] Based on the hierarchical relationship, parse the hierarchical structure of component nodes and map the hierarchical structure to the structural code corresponding to the Apple application;

[0030] Based on the style information, parse the visual attributes of the component node and map the visual attributes to the style code corresponding to the Apple application;

[0031] Based on component behavior information, analyze the behavior logic of component nodes and map the behavior logic to the behavior code of Apple applications;

[0032] Integrate the structure code, style code and behavior code of Apple applications to obtain the application code of native applications.

[0033] In addition, to achieve the above purpose, the present application also proposes a native application generation device, the native application device comprising:

[0034] A text collection module, used for acquiring domain-specific language texts from a user terminal, wherein the domain-specific language texts include a special language text for describing a preset application component;

[0035] A text parsing module, used for parsing a domain-specific language text in a preset parser to obtain a first domain-specific language text, and generating a syntax structure tree in a target format based on the first domain-specific language text;

[0036] A code generation module, used to generate application code of a corresponding native application based on the syntax structure tree of the target format, wherein the native application includes at least one of a web application, a WeChat applet application, an Android application, and an Apple application;

[0037] The code packaging module is used to build application code based on the preset native application tool chain to generate native applications.

[0038] In addition, to achieve the above-mentioned purpose, the present application also proposes a native application generation device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the native application generation method as described above.

[0039] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the native application generation method as described above are implemented.

[0040] In addition, to achieve the above-mentioned purpose, the present application also provides a program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the native application generation method as described above are implemented.

[0041] The present application first obtains a domain-specific language text, namely a DSL text, from the user side (wherein the domain-specific language text includes a special language text for describing a preset application component), and obtains a first domain-specific language text by parsing the domain-specific language text in a preset parser. The domain-specific language text is parsed in the parser, thereby avoiding parsing the domain-specific language text when the application is running, and reducing the performance consumption of the native application when it is running. Secondly, a syntax structure tree in a target format is generated based on the first domain-specific language text, so that the subsequent application code generation process of the native application can be based on clear application component information. Then, based on the syntax structure tree in the target format, application code of the native application is quickly generated, such as application code of at least one of a web application, a WeChat applet application, an Android application, and an Apple application, thereby avoiding complex data parsing and processing when the application is running. Finally, the application code is constructed based on the native application tool chain to generate a native application. The native application does not need to parse the domain-specific language when the application is running, so its runtime performance is better, that is, a native application with better running performance is generated. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0044] Figure 1 A flowchart of the first embodiment of the method for generating a native application of the present application is provided;

[0045] Figure 2 A low-code development schematic diagram provided for the first embodiment of the native application generation method of this application;

[0046] Figure 3 This is a schematic diagram of the actual application of the native application generation method of this application;

[0047] Figure 4 This is a schematic diagram of the module structure of the native application generation device according to an embodiment of the present application;

[0048] Figure 5 Schematic diagram of the device structure of the hardware operating environment involved in the native application generation method in the embodiment of the present application.

[0049] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0050] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0051] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0052] The main solution of the embodiment of the present application is: obtaining domain-specific language text from the user end, wherein the domain-specific language text is a special language text used to describe a preset application component; parsing the domain-specific language text in a preset parser to obtain a first domain-specific language text, and generating a syntax structure tree in a target format based on the first domain-specific language text; based on the syntax structure tree in the target format, generating application code of a corresponding native application, wherein the native application includes at least one of a web application, a WeChat applet application, an Android application, and an Apple application; based on a preset native application tool chain, constructing the application code to generate a native application.

[0053] In this embodiment, for the convenience of description, the identification terminal is used as the execution subject for explanation below.

[0054] Currently, low-code platforms use universal parsers to dynamically parse the code text of domain-specific languages ​​when the application is running to generate native applications. Specifically, the universal parser parses the domain-specific language code when the application is running and generates the corresponding native code to build native applications for multiple platforms. Compared with directly running the native application code, this method of parsing domain-specific language text and generating native code when the application is running adds an additional domain-specific language parsing step, resulting in unnecessary performance consumption. Especially when the application is started, this parsing process significantly increases the startup time, and as the complexity of the application increases, the startup waiting time will be further extended. In general, the native applications generated by the current native application generation method have large performance consumption at runtime.

[0055] The present application first obtains the domain-specific language text of the user end, that is, the DSL text (the domain-specific language text is used to describe the preset application components), and parses the domain-specific language text through a preset parser to obtain the first domain-specific language text. By completing the parsing at the compile time, the dynamic parsing of the specific domain language code when the application is running is avoided, thereby reducing the performance consumption of the native application at run time. Next, a syntax structure tree of the target format is generated based on the first domain-specific language text, so that the subsequent code generation process can be based on clear component information. Then, based on the syntax structure tree, the application code of the native application (including at least one of the web application, WeChat applets, Android applications and Apple applications) is quickly generated, thereby effectively avoiding the complex data parsing and processing when the application is running. In the process of generating the native application code, the terminal parser traverses the component nodes of the syntax structure tree, extracts the hierarchical relationship, style information and component behavior information of the components, and generates the corresponding native application code based on this information. Finally, based on the generated application code, the construction of the native application is completed. This native application generation method is suitable for generating multi-terminal native applications, including web applications, WeChat applets, Android applications and Apple applications. Although multi-terminal native applications are generated based on the same domain-specific language text, the syntax structure tree and final application code generated during the generation process are independently optimized for each terminal.

[0056] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device, a terminal, etc. capable of realizing the above functions. The following takes the terminal as an example to illustrate this embodiment and the following embodiments.

[0057] Based on this, the present application embodiment provides a method for generating a native application, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the native application generation method of the present application.

[0058] In this embodiment, the native application generation method includes steps S10 to S40:

[0059] Step S10, obtaining a domain-specific language text of the user terminal, wherein the domain-specific language text includes a special language text for describing a preset application component;

[0060] It should be noted that the user end refers to the visual application development platform. The domain-specific language is a scripting language in a specific format used to store and represent visual applications. It is stored in the form of text to obtain domain-specific language text. Different visual development platforms usually design their own unique domain-specific languages. Unlike general programming languages, domain-specific languages ​​are more concise and easy to express domain concepts for specific application scenarios or fields. The preset application component refers to the component that the user moves from the component area to the application editing area through visual operations such as dragging and dropping through the user end, that is, the visual application development platform, and completes the editing. The user can develop the application interface of the application by freely combining components. Application components can include button components, text components, and form components.

[0061] Optionally, the user operates the application component through the visual application development platform, thereby determining the application component that should be included in the native application that the user needs to develop, and obtaining the domain-specific language text that describes the application component on the visual application development platform.

[0062] For example, refer to Figure 2 In a low-code development platform, commonly used application components such as text components, value components, amount components, mailbox components, date components, time components, phone components, region components, formula components, check item components, level components and text combination components are provided. A developer is editing a form named Order in the form design area, placing application components in the application editing area, designing the form, placing text components under the title of the form, placing radio components under the order type, placing add components under the sales consultant, placing radio components under the status, placing text components under the status reason and status description, placing amount components under the total amount of the order under the payment information of the form, placing formula components under the discount, placing amount components under the amount after discount, etc. The application components can also be modified in the form style, such as changing the number of component columns to 1, changing the field title to top-aligned on the personal computer side, changing the field title to top-aligned on the mobile side / web side, and finally getting a form page. The terminal will obtain the domain-specific language text used by this low-code platform to describe the application components in this form page.

[0063] Step S20, parsing the domain specific language text in a preset parser to obtain a first domain specific language text, and generating a syntax structure tree in a target format based on the first domain specific language text;

[0064] It should be noted that the preset parser is a special parsing tool for processing and parsing domain-specific languages. The parser analyzes the grammatical rules of the domain-specific language text and converts it into a data structure that can be understood by the application program.

[0065] Optionally, the parser can generate the first domain-specific language text through two steps of lexical analysis and grammatical analysis according to the grammatical definition of the domain-specific language text. The target format refers to an intermediate expression generated by the parser during the parsing process, which is usually used to describe the structure of the domain-specific language at a higher level. This format not only simplifies the definition of application components, but also provides a basis for the subsequent generation of application code for native applications. The target format is usually adapted according to different platforms and application types to ensure that component requirements on multiple terminal applications (such as web applications, WeChat applets, Android applications, Apple applications, etc.) can be covered. Optionally, the target format can be JSON format and XML format. By parsing and converting the syntax structure tree in JSON and XML format, application code for multiple terminal native applications can be generated. JSON (JavaScript Object Notation) is a lightweight data exchange format that is easy to read and write and is widely used for data transmission. XML (eXtensible Markup Language) is a markup language that describes structured data and uses tags to organize and define data.

[0066] For example, assuming that there is a DSL text describing a simple interface including a title and a button, the parser will convert the DSL text into a format that can be understood by the parser, usually a data structure (such as a tree structure). The parser obtains the first domain-specific language text by performing lexical analysis and grammatical analysis on the DSL text corresponding to the application component. Optionally, the first domain-specific language text is a more structured representation relative to the domain-specific language text, such as a text in JSON format or XML format. Finally, the first domain-specific language text is converted into a data structure in JSON format or XML format. This data structure is a tree structure, which is more hierarchical and more structured than the first domain-specific language text. The first domain-specific language text is the result of preliminary parsing of the DSL text. It is a direct translation of the DSL text, usually containing information such as components, attributes, and behaviors, but still close to the semantics of the original text. The syntax structure tree is a more hierarchical and structured data representation form. It not only contains information such as components and attributes, but also clearly expresses the hierarchical relationship, attribute dependency, event binding, etc. between these components. The syntax structure tree can reflect the component tree structure of the application and is used for subsequent code generation.

[0067] Step S30, generating application code of a corresponding native application based on the syntax structure tree of the target format, wherein the native application includes at least one of a web application, a WeChat applet application, an Android application, and an Apple application;

[0068] It should be noted that mapping refers to converting certain characteristics, attributes or elements of a data set into another form or format so that it can adapt to specific needs or purposes, usually including data conversion, structure mapping and semantic conversion. Native applications refer to applications developed using the official default development framework and technology, such as Android applications developed using Java or Kotlin, Apple applications developed using Swift, web applications developed using React or Vue, and WeChat mini-program applications developed using WXML, WXSS and JavaScript.

[0069] It should be noted that the generated application code is the code of the component interface (including each application component). The business-level code of the native application can be manually coded by the developer. The subsequent construction of the native application is based on the component interface code and business-level code generated by this solution. Java, Kotlin, JavaScript and Swift are all programming languages ​​used for application development on different platforms and have no specific semantic meaning. React and Vue are application development frameworks and have no specific semantic meaning, while WXML and WXSS are markup languages ​​and style sheet languages ​​used in WeChat app development and have no specific semantic meaning.

[0070] Specifically, based on the syntax structure tree in JSON and XML format, the information in the syntax structure tree is used to generate application code of the corresponding native application.

[0071] Step S40: construct the application code based on the preset native application tool chain to generate a native application.

[0072] It should be noted that the preset native application toolchain refers to a set of standardized tools and technologies used to generate, build and deploy native applications, such as webpack, Xcode, etc. Webpack and Xcode are build tools without specific semantic meanings. These toolchains are usually provided by native application development platforms or operating systems to compile application code into applications that can eventually run on specific platforms. Building is the entire process of processing application code, resources and configuration files into a final native application that can run on a specific platform. A specific platform refers to the specific environment or system on which a native application or software will run, such as an operating system platform, a web application platform, a specific application platform (WeChat applets), and a hardware platform (mobile devices, desktop computers, and embedded devices).

[0073] Specifically, during the build process, the native application tool chain integrates the application code with related resource files (such as images, audio, configuration files, etc.), and after steps such as compilation and linking, generates an executable file or application package that meets the requirements of the target platform. For example, for Android applications, the build process compiles Java or Kotlin code into a dex file and packages it into an apk file. For Apple applications, the Swift code is compiled into a binary file and packaged into an ipa file. For web applications, Vue code and React code are packaged into a web application. For WeChat mini-program applications, WXML, WXSS and JavaScript code are packaged into the mini-program application package.

[0074] It should be noted that the dex file refers to the bytecode file in the Android application, which contains the compiled Java or Kotlin code. The apk file refers to the installation package of the Android application, which contains all the code, resource files and configuration information. The ipa file refers to the installation package of the Apple application, which contains the compiled code and resource files.

[0075] The present application first obtains a domain-specific language text, namely a DSL text, from the user side (wherein the domain-specific language text includes a special language text for describing a preset application component), and obtains a first domain-specific language text by parsing the domain-specific language text in a preset parser. The domain-specific language text is parsed in the parser, thereby avoiding parsing the domain-specific language text when the application is running, and reducing the performance consumption of the native application when it is running. Secondly, a syntax structure tree in a target format is generated based on the first domain-specific language text, so that the subsequent application code generation process of the native application can be based on clear application component information. Then, based on the syntax structure tree in the target format, application code of the native application is quickly generated, such as application code of at least one of a web application, a WeChat applet application, an Android application, and an Apple application, thereby avoiding complex data parsing and processing when the application is running. Finally, the application code is constructed based on the native application tool chain to generate a native application. The native application does not need to parse the domain-specific language when the application is running, so its runtime performance is better, that is, a native application with better running performance is generated.

[0076] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above description, and will not be repeated in the following. On this basis, step S30 generates the application code of the corresponding native application based on the syntax structure tree of the target format, and also includes steps A31~A32:

[0077] Step A31, traversing the component nodes of the syntax structure tree, obtaining the hierarchical relationship, style information, and component behavior information of the component nodes, wherein the hierarchical relationship includes the organizational structure of the application component in the native application to be generated, the style information includes the visual attributes of the application component in the native application to be generated, and the component behavior information includes the interaction logic of the application component;

[0078] Step A32, generating application code of the native application based on the hierarchical relationship, style information and component behavior information.

[0079] It should be noted that the component node refers to the basic unit that represents the application component in the syntax structure tree. Each node contains detailed information about the application component, such as the type, location, parent-child relationship, visual style, and interactive behavior of the application component. The component node defines the layout and function of the component in the application through its attributes and child nodes, and is a key data structure for building and rendering the application interface. The hierarchical relationship refers to the description of the organizational structure and hierarchical relationship of the components in the application, such as the parent-child relationship of the application components and the arrangement order of the components in the interface. Style information refers to the description of the visual performance of the component in the application, including attributes such as color, font, margin, size, etc., which are used to control the appearance and style of the component. Component behavior information refers to the description of the interactive logic and dynamic behavior of the component, such as the response behavior triggered by user clicks, slides, and other operations and how it is handled.

[0080] Specifically, first parse each component node in the syntax structure tree and extract the hierarchical relationship of the component nodes, including the parent-child hierarchy of the components in the application and the position arrangement in the interface. Then extract the style information, that is, the visual performance details of the component, such as background color, border style, font size, etc., to ensure that the appearance of the component meets the design requirements. Then, extract the component behavior information, including the interaction logic and dynamic behavior of the component, such as responding to user clicks, drags, slides and other operations, and define how to handle these operations to achieve the expected user experience. The obtained hierarchical relationship, style information and component behavior information are summarized and integrated into the corresponding application code of the native application to be generated, thereby ensuring the correct display and interactive functions of the component in the native application.

[0081] In this embodiment, by traversing the syntax structure tree, the hierarchical information, style information and component behavior information between application components are obtained, and the application code is generated with the information with a clear structure, thereby accelerating the application code generation speed.

[0082] Based on the first embodiment or the second embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those of the first embodiment or the second embodiment can refer to the above description, and will not be repeated later. On this basis, the native application is a web application, and step A32 generates the application code of the native application based on the hierarchical relationship, style information and component behavior information, including steps A321~A324:

[0083] Step A321, parsing the component hierarchy of the component node based on the hierarchical relationship, and mapping the component hierarchy to a hypertext markup language tag structure corresponding to the web application;

[0084] It should be noted that web applications are applications that run in browsers and do not require the installation of any independent applications. Web applications can be accessed through the terminal's browser. Hypertext Markup Language (HTML) refers to the basic unit used to define the content and structure of a web page, such as 、 、 <header>Tags, such as HTML tags, the hypertext markup language tag structure refers to the hierarchy and structural relationship of tags in a web page. This structure defines the layout and organization of web page content. Parsing refers to analyzing and processing the hierarchical structure information of component nodes to understand the location and arrangement of components in web page applications. Mapping refers to converting the hierarchical relationship information obtained by parsing into an HTML tag structure, that is, mapping the organizational structure of components into HTML tags and their nested relationships suitable for web page display.

[0085] in addition, 、 、 <header>Tags such as <head> refer to HTML tags used to construct the structure of web pages and have no actual semantic meaning.

[0086] Specifically, according to the hierarchical information of the component nodes, such as the parent-child relationship and the arrangement order, the hierarchical information is converted into corresponding HTML tags and their nesting levels, so as to construct the HTML structure of the application web page.

[0087] Step A322, parsing the visual attributes of the component node based on the style information, and mapping the visual attributes to cascading style sheet style rules corresponding to the webpage application;

[0088] It should be noted that visual attributes refer to the description of the appearance characteristics of components in web applications, such as color, font, margin, size, etc., which are used to control the display style of components. Cascading Style Sheets (CSS, full name Cascading Style Sheets) refers to a language used to define the style and layout of web content, and is used to specify the appearance and layout of HTML tags. Cascading Style Sheet style rules refer to the style specifications defined by CSS, which are used to set the visual effects of web page elements.

[0089] Specifically, based on the style information of the component node, it is converted into corresponding CSS rules. These rules define the appearance and layout of the component in the web page, such as setting font color, background color, margin and other styles to ensure that the visual effect of the component meets the design requirements.

[0090] Step A323, based on the component behavior information, analyzing the behavior logic of the component node, and mapping the behavior logic into a script language code corresponding to the web application;

[0091] It should be noted that behavioral logic refers to the dynamic response or operation behavior exhibited by a component during user interaction. For example, the event triggered when a user clicks a button, the style changes when the mouse hovers, the processing logic after the content of the input box changes, etc. These behavioral logics define the way users interact with the application, and how the application updates its own status or performs specific functions based on these interactions. Scripting language code refers to the programming language code used to define and control dynamic behaviors in web pages. Common scripting languages ​​such as JavaScript can implement event processing, data validation, animation effects, asynchronous data requests and other functions in web applications by writing scripting language codes. Scripting language codes enable web applications to not only have static content, but also respond to user operations and update dynamically.

[0092] Specifically, the interaction rules or conditions contained in the component nodes are parsed and converted into corresponding script language codes for controlling the interaction operations in the web application.

[0093] Step A324, integrating the HTML tag structure, CSS style rules and scripting language code of the web application to obtain the application code of the native application.

[0094] It should be noted that integration refers to the unified combination and coordination of the various parts of a web application (i.e., the hypertext markup language tag structure, cascading style sheet style rules, and scripting language code) to form a complete, operational web application. During the integration process, it is necessary to ensure that the dependencies, hierarchical structures, and interactive logic of different parts can be correctly connected and executed to generate the application code of the web application.

[0095] Specifically, the integration includes using the parsed HTML tag structure as the content and layout basis of the web page, and associating CSS style rules with the corresponding HTML tags to achieve the visual effects of the page. Subsequently, the generated scripting language code is embedded into the page to control user interaction and dynamic behavior. Through this integration, a complete web application code is finally obtained, which contains both the static content of the page and the dynamic interaction capabilities, and can be correctly rendered and run in the web page.

[0096] The content of this embodiment is one of the practical application scenarios of this solution. Figure 3 , when developing / editing an application, during static compilation, the application code of the web application is generated by parsing the domain-specific language text. Specifically, first, the domain-specific language text of the user end is obtained, and the text is used to describe the preset application component. Then, the domain-specific language text containing the domain-specific language is parsed in the preset parser to obtain a syntax structure tree in the target format, such as JSON or XML format. Based on the syntax structure tree, the corresponding native application code is generated, including at least one of a web application, a WeChat applet application, an Android application, and an Apple application. The generated web application code is integrated, including mapping the hierarchical relationship of the parsed component nodes to an HTML tag structure, mapping the style information to CSS style rules, and mapping the behavior logic to a script language code. Finally, by integrating HTML tags, CSS styles, and script language codes, a complete web application code is generated, which can be directly built using the native tool chain of the web application for the front end, and the front-end URL / Web static deployment package of the web application is generated (URL is a uniform resource locator, which is a standard address used to identify and locate resources on the Internet, and Web is also a web page). It should be noted that HTML tag structure, CSS style rules and script language code are the most basic native codes for building web applications. For the syntax structure tree of the target format, it can also be parsed to generate the framework code for building web applications. Common frameworks for building web applications include React framework and Vue framework. React framework is an open source script language library used to build user interfaces. Its core concept is component development, which allows developers to split the interface into independent and reusable components. Each component is responsible for rendering its own part of the interface. Vue framework is an open source script language library, which is also used to build user interfaces. Unlike React, it pays more attention to ease of use and development experience. The script language used by Vue framework is JavaScript, while the script language of React framework is JSX (JSX is a syntax extension of Javascript, and JSX has no specific semantic meaning). The web application generated by this solution has converted the specific domain language text into the application code of the native web application before running, without the need for conversion during the application runtime, making the web application developed using the low-code development platform a truly native web application, and the performance consumption of the web application runtime is also effectively reduced.

[0097] Based on the first embodiment or the second embodiment of the present application, in the fourth embodiment of the present application, the same or similar contents as those in the first embodiment or the second embodiment can be referred to the above description, and will not be repeated later. On this basis, the native application is a WeChat applet application, and step A32 generates the application code of the native application based on the hierarchical relationship, style information, and component behavior information, including steps A331~A334:

[0098] Step A331, based on the hierarchical relationship, parse the component hierarchy of the component node, and map the component hierarchy to a structural tag corresponding to the WeChat applet application;

[0099] It should be noted that WeChat Mini Program applications are built-in applications that run in the WeChat application of the terminal. WeChat Mini Programs use specific structural tags to define the layout and structure of the interface. Specifically, according to the hierarchical information of component nodes, such as parent-child relationships and arrangement order, the hierarchical information is converted into corresponding WeChat Mini Program structural tags and their nested levels to build the page structure of the Mini Program.

[0100] Step A332, based on the style information, parse the visual attributes of the component node and map the component node to the style sheet corresponding to the WeChat applet.

[0101] It should be noted that WeChat Mini Programs use WXSS to define the visual style of components, including color, font, margin, etc. Specifically, based on the style information of the component node, it is converted into the corresponding WXSS style rules. The WXSS style rules define the appearance and layout of the component in the Mini Program, ensuring that the visual effect of the component meets the design requirements.

[0102] Step A333, based on the component behavior information, parse the behavior logic of the component node, and map the behavior logic into the script language code corresponding to the WeChat applet.

[0103] It should be noted that WeChat Mini Programs use scripting languages ​​to process component behavior logic, including user interaction events (such as clicks, slides, etc.). Specifically, by parsing the interaction rules or conditions contained in the component nodes, they are converted into corresponding scripting language codes (such as Javascript codes) to control dynamic behaviors and user interactions in WeChat Mini Programs.

[0104] Step A334, integrate the structural tags, style sheets and script language codes of the WeChat mini-program application to obtain the application code of the native application.

[0105] It should be noted that integration refers to the unified combination and coordination of the various parts of the WeChat applet (i.e., structural tags, style sheets, and scripting language codes) so that they together constitute a complete and executable applet. During the integration process, it is necessary to ensure that the dependencies, hierarchical structures, and interaction logics of the different parts can be correctly connected and executed to generate the application code of the WeChat applet. Specifically, the integration includes using the parsed WeChat applet structural tags as the content and layout basis of the page, and associating the WXSS style rules with the corresponding structural tags to achieve the visual effect of the page. Subsequently, the generated scripting language code is embedded into the page to control user interaction and dynamic behavior. Through this integration, the complete WeChat applet application code is finally obtained, which contains both the static content of the page and the dynamic interaction capabilities, and can be correctly rendered and run in the WeChat applet.

[0106] This embodiment is one of the practical application scenarios of this solution. Figure 3 , when developing / editing an application, during static compilation, the application code of the WeChat applet application is generated by parsing the domain-specific language text. Specifically, first obtain the domain-specific language text of the user end, which is used to describe the preset application components. Then, parse the domain-specific language text in the preset parser to obtain a syntax structure tree in the target format, such as JSON or XML format. Based on the syntax structure tree, generate the corresponding WeChat applet native application code, which includes the structure tags, style sheets and script language codes in the WeChat applet. The generated WeChat applet application code is integrated, including parsing the hierarchical relationship of component nodes mapped into structure tags, that is, WXML, mapping style information into WXSS style rules, and mapping behavior logic into script language code (that is, js code, js is the abbreviation of Javascript). Finally, by integrating structural tags, WXSS styles and script language codes, a complete WeChat mini-program application code is generated. The WeChat mini-program application code can be directly tested and released in the WeChat developer tool and built into a page URL / Web static deployment package (URL is a uniform resource locator, which is a standard address used to identify and locate resources on the Internet, and the Web is a web page). Similarly, when running the WeChat mini-program application through the page URL / Web static deployment package, there is no need to parse domain-specific language text, thereby effectively reducing the performance consumption of the WeChat mini-program application during runtime.

[0107] Based on the first embodiment or the second embodiment of the present application, in the fifth embodiment of the present application, the same or similar contents as those of the first embodiment or the second embodiment can be referred to the above description, and will not be repeated hereafter. On this basis, the native application is an Android application, and step A32 generates the application code of the native application based on the hierarchical relationship, style information and component behavior information, including steps A341 to A344:

[0108] Step A341, based on the hierarchical relationship, parsing the hierarchical structure of the component nodes, and mapping the hierarchical structure to an Android layout file corresponding to the Android application;

[0109] It should be noted that Android applications are applications running on the Android operating system and are mainly used in various Android devices. Shopping software in Android phones is a type of Android application. Android layout files are used to define the structure of the application interface and the arrangement of components. Specifically, based on the hierarchical information of component nodes, such as parent-child relationships and arrangement order, the hierarchical information is converted into various view elements and their nested relationships in the Android XML layout file format. This includes converting components into ViewGroup or View elements and specifying their positions and layout attributes according to the hierarchical structure.

[0110] Android XML layout files are files used to define the interface structure of Android applications. They use XML (Extensible Markup Language) format to describe the arrangement, size, color, font and other attributes of each view component in the application. Android XML layout files will be parsed and converted into actual interfaces when the application is compiled and run. ViewGroup and View elements refer to two core components in Android, which are used for Android application layout and have no actual semantic meaning.

[0111] Step A342, parsing the visual attributes of the component node based on the style information, and mapping the visual attributes to Android style resources corresponding to the Android application;

[0112] It should be noted that Android style resources are used to define the visual effects of components, such as color, font, margin, etc. Specifically, according to the style information of the component node, it is converted into style rules in the Android XML style resource file. This includes creating or updating style definitions in the styles.xml file and applying these styles to the corresponding layout elements to ensure that the appearance of the component meets the design requirements. The styles.xml file is a resource file used to define the global style in Android applications. It contains multiple style definitions that are used to control the appearance of components in the application, such as color, font, margin, background, etc. XML (Extensible Markup Language) is a markup language used to describe data, which organizes data through tags.

[0113] Step A343, based on the component behavior information, parsing the behavior logic of the component node, and mapping the behavior logic to the behavior code corresponding to the Android application;

[0114] It should be noted that the behavior code of Android applications is mainly used to define the interaction between users and applications. The behavior logic includes the operation events triggered by users on the interface, such as clicking a button, sliding the screen, or entering text, and the application's response is implemented through event handling code.

[0115] Specifically, the interaction rules defined in the component node are parsed and mapped to Android event listeners or callback functions. Common behavior codes include the implementation of interfaces such as OnClickListener and OnTouchListener to handle user clicks, touches, and other operations. According to the interaction requirements of each component, the corresponding Java or Kotlin code is generated, and the behavior logic is embedded in the corresponding activity class or fragment class to ensure that the user's operation can be correctly responded to and processed.

[0116] In addition, OnClickListener and OnTouchListener are interfaces used to handle user interactions in Android development.

[0117] Step A344, integrating layout information, Android style resources and behavior codes in the Android layout file of the Android application to obtain application code of the native application.

[0118] It should be noted that integration refers to merging the generated layout files, style resource files, and behavior codes into a complete Android application project to ensure that they can work together at runtime. Specifically, the layout file is responsible for describing the hierarchy of the application interface, the style resource controls the appearance of the components, and the behavior code defines the user's interaction logic. During the integration process, it is necessary to ensure that the references and bindings between the layout, style, and behavior codes are correct. For example, bind the component identifier in the layout file with the event handling in the behavior code to ensure that the corresponding event can be triggered when the user clicks the button. The final generated Android application code can be imported into a development environment such as Android Studio for compilation, debugging, and deployment to form a complete Android application.

[0119] In addition, Android Studio is an integrated development environment designed specifically for Android development.

[0120] In this embodiment, refer to Figure 3 , when developing / editing an application, during static compilation, the application code of the Android application is generated by parsing the domain-specific language text. Specifically, first obtain the domain-specific language text of the user end, which is used to describe the preset application components. Then, parse the domain-specific language text in the preset parser to obtain a syntax structure tree in XML format. Based on the syntax structure tree, the application code of the corresponding Android application is generated. The application code of the Android application can be compiled, debugged and deployed through Android Studio, and finally an apk (Android Package) file is generated. After the user installs the apk file, there is no need to parse the specific domain language code when starting the Android application, which reduces the performance consumption at runtime, thereby achieving better performance of the Android application at runtime.

[0121] Based on the first embodiment or the second embodiment of the present application, in the sixth embodiment of the present application, the same or similar contents as the first embodiment or the second embodiment can refer to the above introduction, and will not be repeated later. On this basis, the native application is an Apple application, and step A32 generates the application code of the native application based on the hierarchical relationship, style information and component behavior information, including steps A351~A354:

[0122] Step A351, based on the hierarchical relationship, parse the hierarchical structure of the component node, and map the hierarchical structure into the structure code corresponding to the Apple application;

[0123] It should be noted that Apple applications are native applications running on Apple devices, including Apple social applications. The structural code of Apple applications refers to the view hierarchy code in Swift, which is used to define the parent-child relationship and layout structure of each view component in the interface. Swift is parsed from the hierarchical relationship in the syntax structure tree in XML format and is the programming language for Apple applications in native applications.

[0124] Specifically, by parsing the hierarchical relationship of component nodes, they are mapped to corresponding Apple application view codes.

[0125] For example, for a certain form component, a text box sub-component is nested inside the form component. By parsing the hierarchical relationship of the component nodes, the form component and the text box sub-component are mapped to corresponding Apple application view codes.

[0126] Step A352, parsing the visual attributes of the component node based on the style information, and mapping the visual attributes to the style code corresponding to the Apple application;

[0127] It should be noted that the style code of Apple applications refers to the code used in Swift to control the appearance of components. The corresponding Apple application style code is generated based on the visual attributes of the parsed component nodes. For example, by converting the style information of the component such as color, margin, font, etc. into the style attributes of the Swift modifier, the component appearance is ensured to be consistent with the original component appearance.

[0128] Step A353, based on the component behavior information, parsing the behavior logic of the component node, and mapping the behavior logic to the behavior code of the Apple application;

[0129] It should be noted that the behavior code of Apple applications refers to the code that controls the interaction logic of components, which usually implements user interaction behaviors through Swift's @State, @Binding, @ObservedObject and other property wrappers. Specifically, the behavior logic of components, such as user interaction operations such as clicking, dragging, and sliding, is parsed and converted into the corresponding event processing code in Swift.

[0130] In addition, property wrappers such as @State, @Binding, and @ObservedObject are tools used in Swift to manage view states and data flows, enabling Swift views to automatically respond to state changes, thereby simplifying view state management and update processes.

[0131] Step A354, integrating the structure code, style code and behavior code of the Apple application to obtain the native application code.

[0132] It should be noted that integration refers to combining the previously generated structure code, style code, and behavior code to generate a complete Apple application code. This process ensures that the view hierarchy, visual style, and user interaction can be correctly rendered and executed on Apple devices.

[0133] Specifically, the integration includes combining the view hierarchy and modifiers in Swift to form an executable Apple application code file. Apple application development tool Xcode will compile the Apple application code file into an ipa file.

[0134] In addition, Xcode is an integrated development environment that supports Apple applications.

[0135] This embodiment is also one of the practical application scenarios of this solution. Figure 3 , when developing / editing applications, during static compilation, the application code of the Apple application is generated by parsing the domain-specific language text. Specifically, first obtain the domain-specific language text of the user end, which is used to describe the preset application components. Then, parse the domain-specific language text in the preset parser to obtain a syntax structure tree in XML format. Based on the syntax structure tree, generate the corresponding application code of the Apple application, parse the hierarchical relationship and style information of the component nodes, map the form components, text boxes, buttons and other contents into Swift view code, and implement user interaction through behavioral logic. After integration, the generated application code can be compiled by Xcode to eventually form an executable Apple application file, that is, an ipa (iOS App Store Package) file. When users run the ipa file, there is no need to parse the specific domain language text, which reduces the performance consumption of the Apple application runtime and effectively improves the speed of the Apple application runtime.

[0136] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the native application generation method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0137] This application also provides a native application generation device, please refer to Figure 4 , the native application generating device comprises:

[0138] A text collection module 10, used to obtain a domain-specific language text from a user terminal, wherein the domain-specific language text includes a special language text for describing a preset application component;

[0139] The text parsing module 20 is used to parse the domain-specific language text in a preset parser to obtain the first domain-specific language text, and generate a syntax structure tree in a target format based on the first domain-specific language text;

[0140] A code generation module 30, for generating application code of a corresponding native application based on the syntax structure tree of the target format, wherein the native application includes at least one of a web application, a WeChat applet application, an Android application, and an Apple application;

[0141] The code packaging module 40 is used to construct the application code based on the preset native application tool chain to generate a native application.

[0142] The native application generation device provided by the present application adopts the native application generation method in the above embodiment, which can solve the technical problem that the native application generated by the current native application generation method has large performance consumption during runtime. Compared with the prior art, the beneficial effects of the native application generation device provided by the present application are the same as the beneficial effects of the native application generation method provided by the above embodiment, and other technical features in the native application generation device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0143] The present application provides a native application generation device, which includes: at least one processor; and a memory that is communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the native application generation method in the above-mentioned embodiment 1.

[0144] Reference below Figure 5 , which shows a schematic diagram of the structure of a native application generation device suitable for implementing the embodiments of the present application. The native application generation device in the embodiments of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The native application generation device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0145] like Figure 5 As shown, the native application generation device may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the native application generation device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the native application generation device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a native application generation device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or provided instead.

[0146] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0147] The native application generation device provided by the present application adopts the native application generation method in the above embodiment, which can solve the technical problems of native application generation. Compared with the prior art, the beneficial effects of the native application generation device provided by the present application are the same as the beneficial effects of the native application generation method provided by the above embodiment, and the other technical features in the native application generation device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0148] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0149] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0150] The present application provides a storage medium having computer-readable program instructions (ie, computer programs) stored thereon, the computer-readable program instructions being used to execute the native application generation method in the above-mentioned embodiment.

[0151] The storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0152] The above storage medium may be included in the native application generation device; or may exist independently without being assembled into the native application generation device.

[0153] The above-mentioned storage medium carries one or more programs. When the above-mentioned one or more programs are executed by a native application generation device, the native application generation device: obtains a domain-specific language text from a user terminal, wherein the domain-specific language text is a special language text used to describe a preset application component; parses the domain-specific language text in a preset parser to obtain a first domain-specific language text, and generates a syntax structure tree in a target format based on the first domain-specific language text; generates application code of a corresponding native application based on the syntax structure tree in the target format, wherein the native application includes at least one of a web application, a WeChat applet application, an Android application, and an Apple application; and constructs the application code based on a preset native application tool chain to generate the native application.

[0154] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0155] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0156] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0157] The storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned native application generation method, and can solve the technical problem that the native application generated by the current native application generation method has large performance consumption during runtime. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the native application generation method provided in the above-mentioned embodiment, and will not be repeated here.

[0158] The present application also provides a program product, including a computer program, which implements the steps of the native application generation method as described above when executed by a processor.

[0159] The computer program product provided by the present application can solve the technical problem that the native application generated by the current native application generation method consumes a lot of performance during runtime. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the native application generation method provided by the above embodiment, and will not be repeated here.

[0160] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.< / header> < / header>

Claims

1. A method for generating a native application, characterized in that: The method includes: Acquire a domain-specific language text of the user terminal, wherein the domain-specific language text includes a special language text for describing a preset application component; Parsing the domain-specific language text in a preset parser to obtain a first domain-specific language text, generating a syntax structure tree in a target format based on the first domain-specific language text, wherein the syntax structure tree includes components, hierarchical relationships between components, attribute dependencies, and event bindings, and the parser generates the first domain-specific language text through lexical analysis and grammatical analysis according to the grammatical definition of the domain-specific language text; Generate application code of corresponding native applications based on the syntax structure tree of the target format, wherein the native applications include web applications, WeChat applet applications, Android applications and Apple applications, the application code of the Android application is developed using Java or Kotlin, the application code of the Apple application is developed using Swift, the application code of the web application is developed using React or Vue, and the application code of the WeChat applet application is developed using WXML, WXSS and JavaScript; Based on the preset native application tool chain, the application code is built to generate the native application. For the application code of the Android application, the construction process compiles the Java or Kotlin code into a dex file and packages it into a native application in the apk file format. For the application code of the Apple application, the Swift code is compiled into a binary file and packaged into a native application in the ipa file format. For the application code of the web application, the Vue code and the React code are packaged into a native application applied in the web page. For the application code of the WeChat applet application, the WXML, WXSS and JavaScript codes are packaged into the native application of the applet. The step of generating the application code of the corresponding native application based on the syntax structure tree of the target format includes: Traversing the component nodes of the syntax structure tree, obtaining the hierarchical relationship, style information and component behavior information of the component nodes, wherein the hierarchical relationship includes the organizational structure of the application component in the native application to be generated, the parent-child relationship of the application component and the arrangement order of the application component in the interface, the style information includes the visual attributes of the application component in the native application to be generated, the visual attributes are the appearance features of the component in the web application, including color, font, margin, size, and the component behavior information includes the interaction logic of the application component; Based on the hierarchical relationship, style information and component behavior information, the application code of the native application is generated, wherein the process of generating the native application includes parsing each component node of the syntax structure tree, extracting the hierarchical relationship of the component nodes, then extracting the style information of the component nodes, and then extracting the component behavior information of the component nodes, aggregating the hierarchical relationship of the component nodes, style information and component behavior, and parsing the behavior logic based on the component behavior information, wherein the behavior logic refers to the dynamic response or operation behavior exhibited by the component during the user interaction process, and the dynamic response includes the style dynamic response.

2. The method according to claim 1, characterized in that The native application is a web application, and the step of generating application code of the native application based on the hierarchical relationship, style information and component behavior information includes: Based on the hierarchical relationship, parsing the component hierarchy of the component node, and mapping the component hierarchy to a hypertext markup language tag structure corresponding to the webpage application; Based on the style information, parsing the visual attributes of the component node, and mapping the visual attributes to cascading style sheet style rules corresponding to the webpage application; Based on the component behavior information, analyzing the behavior logic of the component node, and mapping the behavior logic into a script language code corresponding to the web application; The hypertext markup language tag structure, cascading style sheet style rules and scripting language code of the web application are integrated to obtain the application code of the native application.

3. The method according to claim 1, characterized in that The native application is a WeChat applet application, and the step of generating application code of the native application based on the hierarchical relationship, style information and component behavior information further includes: Based on the hierarchical relationship, the component hierarchy of the component node is parsed, and the component hierarchy is mapped to a structural tag corresponding to the WeChat applet application; Based on the style information, the visual attributes of the component node are parsed, and the component node is mapped to a style sheet corresponding to the WeChat applet; Based on the component behavior information, the behavior logic of the component node is parsed, and the behavior logic is mapped into a script language code corresponding to the WeChat applet; The structural tags, style sheets and scripting language codes of the WeChat applet application are integrated to obtain the application code of the native application.

4. The method according to claim 1, characterized in that The native application is an Android application, and the step of generating application code of the native application based on the hierarchical relationship, style information and component behavior information further includes: Based on the hierarchical relationship, parsing the hierarchical structure of the component nodes, and mapping the hierarchical structure to an Android layout file corresponding to the Android application; Based on the style information, parsing the visual attributes of the component node, and mapping the visual attributes to Android style resources corresponding to the Android application; Based on the component behavior information, analyzing the behavior logic of the component node, and mapping the behavior logic to a behavior code corresponding to the Android application; The layout information, Android style resources and behavior codes in the Android layout file of the Android application are integrated to obtain the application code of the native application.

5. The method according to claim 1, characterized in that The native application is an Apple application, and the step of generating application code of the native application based on the hierarchical relationship, style information and component behavior information further includes: Based on the hierarchical relationship, the hierarchical structure of the component node is parsed, and the hierarchical structure is mapped into a structural code corresponding to the Apple application; Based on the style information, parsing the visual attributes of the component node, and mapping the visual attributes to the style code corresponding to the Apple application; Based on the component behavior information, analyzing the behavior logic of the component node, and mapping the behavior logic into the behavior code of the Apple application; The structure code, style code and behavior code of the Apple application are integrated to obtain the application code of the native application.

6. A native application generation device, characterized in that: The device comprises: A text collection module, used for acquiring domain-specific language texts from a user terminal, wherein the domain-specific language texts include a special language text for describing a preset application component; A text parsing module, used for parsing the domain-specific language text in a preset parser to obtain a first domain-specific language text, and generating a grammatical structure tree in a target format based on the first domain-specific language text, wherein the grammatical structure tree includes components, hierarchical relationships between components, attribute dependencies, and event bindings, and the parser generates the first domain-specific language text through lexical analysis and grammatical analysis according to the grammatical definition of the domain-specific language text; A code generation module is used to generate application code of corresponding native applications based on the syntax structure tree of the target format, wherein the native applications include web applications, WeChat applet applications, Android applications and Apple applications, the application code of the Android application is developed using Java or Kotlin, the application code of the Apple application is developed using Swift, the application code of the web application is developed using React or Vue, and the application code of the WeChat applet application is developed using WXML, WXSS and JavaScript, and the generation of application code of corresponding native applications based on the syntax structure tree of the target format includes traversing component nodes of the syntax structure tree, obtaining hierarchical relationships, style information and component behavior information of the component nodes, wherein the hierarchical relationships include the organizational structure of the application components in the native application to be generated and the parent-child relationship and The arrangement order of application components in the interface, the style information includes the visual attributes of the application components in the native application to be generated, the visual attributes describe the appearance characteristics of the components in the web application, including color, font, margin, size, and the component behavior information includes the interaction logic of the application components; based on the hierarchical relationship, style information and component behavior information, generate the application code of the native application, wherein the process of generating the native application includes parsing each component node of the syntax structure tree, extracting the hierarchical relationship of the component nodes, then extracting the style information of the component nodes, then extracting the component behavior information of the component nodes, aggregating the hierarchical relationship, style information and component behavior of the component nodes, parsing the behavior logic based on the component behavior information, the behavior logic refers to the dynamic response or operation behavior exhibited by the component during the user interaction process, and the dynamic response includes the style dynamic response; The code packaging module is used to build the application code based on a preset native application tool chain to generate the native application. For the application code of the Android application, the construction process will compile the Java or Kotlin code into a dex file, and package it into a native application in the apk file format. For the application code of the Apple application, the Swift code will be compiled into a binary file and packaged into a native application in the ipa file format. For the application code of the web application, the Vue code and the React code will be packaged into a native application used in the web page. For the application code of the WeChat applet application, the WXML, WXSS and JavaScript codes will be packaged into the native application of the applet.

7. A native application generation device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the native application generation method according to any one of claims 1 to 5.

8. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the native application generation method according to any one of claims 1 to 5 are implemented.

9. A program product, characterized in that The program product comprises a computer program, and when the computer program is executed by a processor, the steps of the native application generation method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Software interface code generation method and device

    CN110990010A

  • Automatic terminal code generation method based on visual interface and platform thereof

    CN114064040A