[go: up one dir, main page]

CN118916016B - Native application generation method, device, equipment, storage medium and program product - Google Patents

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

Info

Publication number
CN118916016B
CN118916016B CN202411413458.XA CN202411413458A CN118916016B CN 118916016 B CN118916016 B CN 118916016B CN 202411413458 A CN202411413458 A CN 202411413458A CN 118916016 B CN118916016 B CN 118916016B
Authority
CN
China
Prior art keywords
application
component
native
codes
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202411413458.XA
Other languages
Chinese (zh)
Other versions
CN118916016A (en
Inventor
林大海
曾奋飞
刘林鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Smart City Technology Development Group Co ltd
Original Assignee
Shenzhen Smart City Technology Development Group Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Smart City Technology Development Group Co ltd filed Critical Shenzhen Smart City Technology Development Group Co ltd
Priority to CN202411413458.XA priority Critical patent/CN118916016B/en
Publication of CN118916016A publication Critical patent/CN118916016A/en
Application granted granted Critical
Publication of CN118916016B publication Critical patent/CN118916016B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a native application generation method, a device, equipment, a storage medium and a program product, which relate to the technical field of visual application development and comprise the steps of obtaining domain-specific language texts of a user side, wherein the domain-specific language texts comprise a special language text for describing preset application components, analyzing the domain-specific language texts in a preset analyzer to obtain first domain-specific language texts, generating a grammar structure tree of a target format based on the first domain-specific language texts, generating application codes of corresponding native applications based on the grammar structure tree of the target format, constructing the application codes based on a preset native application tool chain, and generating the native applications, wherein the native applications comprise at least one of web applications, weChat applet applications, android applications and apple applications. The native application generation method can generate the native application with better running performance.

Description

Native application generation method, device, equipment, storage medium and program product
Technical Field
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
Currently, applications at each end dynamically parse DSL (Domain-specific language ) text to generate native applications, using a generic parser, while the application is running. Specifically, the generic parser parses DSL text at application runtime, generates the final required interface objects, and displays them on the screen, thereby building the native application for multiple platforms. This way of parsing DSL text at application runtime adds an extra DSL text parsing step compared to directly running the application code of the native application, resulting in unnecessary performance consumption. Especially when an application is started, the starting time is obviously increased by the analysis process, and the starting waiting time is further prolonged along with the increase of the complexity of the application. In general, the current native application generation method generates a native application with relatively high running performance consumption, and thus, a better native application generation method is needed.
The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present application and is not intended to represent an admission that the foregoing is prior art.
Disclosure of Invention
The application mainly aims to provide a method, a device, equipment, a storage medium and a program product for generating a native application, and aims to solve the technical problem that the current method for generating the native application can generate the native application with larger running performance consumption.
In order to achieve the above object, the present application provides a native application generation method, which includes:
acquiring a domain-specific language text of a user side, wherein the domain-specific language text comprises a special language text for describing a preset application component;
analyzing the field specific language text in a preset analyzer to obtain a first field specific language text, and generating a grammar structure tree in a target format based on the first field specific language text;
Generating application codes of corresponding native applications based on a grammar structure tree of a target format, wherein the native applications comprise at least one of web applications, weChat applet applications, android applications and apple applications;
and constructing application codes based on a preset native application tool chain to generate a native application.
In one embodiment, the step of generating application code of the corresponding native application based on the syntax structure tree of the target format comprises:
Traversing component nodes of a grammar structure tree, and acquiring hierarchical relation, style information and component behavior information of the component nodes, wherein the hierarchical relation comprises an organization structure of an application component in a to-be-generated native application, the style information comprises visual properties of the application component in the to-be-generated native application, and the component behavior information comprises interaction logic of the application component;
and generating application codes of the native application based on the hierarchical relationship, the style information and the component behavior information.
In one embodiment, the native application is a web application, and the step of generating the application code of the native application based on the hierarchical relationship, the style information, and the component behavior information includes:
based on the hierarchical relationship, analyzing the component hierarchy of the component nodes, and mapping the component hierarchy into a hypertext markup language tag structure corresponding to the web page application;
Based on the style information, analyzing the visual attribute of the component node, and mapping the visual attribute into a cascading style sheet style rule corresponding to the webpage application;
Analyzing the behavior logic of the component node based on the component behavior information, and mapping the behavior logic into script language codes corresponding to the webpage application;
integrating the hypertext markup language label structure, the cascading style sheet style rule and the script language code of the webpage application to obtain the application code of the native application.
In an 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, the style information, and the component behavior information further comprises:
Based on the hierarchical relationship, analyzing the component hierarchy of the component nodes, and mapping the component hierarchy into a structural label corresponding to the WeChat applet application;
Based on the style information, analyzing the visual attribute of the component node, and mapping the component node into a style sheet corresponding to the WeChat applet;
analyzing the behavior logic of the component node based on the component behavior information, and mapping the behavior logic into script language codes corresponding to the WeChat applet;
And integrating the structural labels, style sheets and script language codes of the WeChat applet application to obtain the application code of the native application.
In an embodiment, the native application is an android application, and the step of generating the application code of the native application based on the hierarchical relationship, the style information, and the component behavior information further includes:
Based on the hierarchical relationship, analyzing the hierarchical structure of the component nodes, and mapping the hierarchical structure into android layout files corresponding to the android applications;
based on the style information, analyzing the visual attribute of the component node, and mapping the visual attribute into android style resources corresponding to the android application;
analyzing the behavior logic of the component node based on the component behavior information, and mapping the behavior logic into behavior codes corresponding to android applications;
Integrating the layout information, the android style resources and the behavior codes in the android layout file of the android application to obtain the application codes of the native application.
In an embodiment, the native application is an apple application, and the step of generating the application code of the native application based on the hierarchical relationship, the style information, and the component behavior information further includes:
based on the hierarchical relationship, analyzing the hierarchical structure of the component nodes, and mapping the hierarchical structure into a structural code corresponding to the apple application;
based on the style information, analyzing the visual attribute of the component node, and mapping the visual attribute into a style code corresponding to the apple application;
Analyzing the behavior logic of the component node based on the component behavior information, and mapping the behavior logic into behavior codes of the apple application;
And integrating the structure code, the style code and the behavior code of the apple application to obtain the application code of the native application.
In addition, to achieve the above object, the present application also proposes a native application generating apparatus, the native application apparatus including:
the text collection module is used for obtaining a domain-specific language text of the user side, wherein the domain-specific language text comprises a special language text for describing a preset application component;
the text analysis module is used for analyzing the field specific language text in a preset analyzer to obtain a first field specific language text, and generating a grammar structure tree in a target format based on the first field specific language text;
The code generation module is used for generating application codes of corresponding native applications based on a grammar structure tree of a target format, wherein the native applications comprise at least one of webpage applications, weChat applet applications, android applications and apple applications;
And the code packaging module is used for constructing the application code based on a preset native application tool chain to generate a native application.
In addition, in order to achieve the above object, the present application also proposes a native application generating device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the native application generating method as described above.
In addition, in order to achieve the above object, the present application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the native application generation method as described above.
Furthermore, to achieve the above object, the present application provides a program product comprising a computer program which, when executed by a processor, implements the steps of the native application generation method as described above.
According to the method, firstly, the domain-specific language text of a user side, namely DSL text (wherein the domain-specific language text comprises a special language text for describing a preset application component) is obtained, the domain-specific language text is analyzed in a preset analyzer to obtain the first domain-specific language text, the analysis of the domain-specific language text in the analyzer is avoided when the application is running, the performance consumption of the native application in the running process is reduced, secondly, a grammar 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 performed based on clear application component information, and then, based on the grammar structure tree in the target format, the application code of the native application, such as application codes of at least one of a webpage application, a micro-communication applet application, an android application and an apple application, is generated quickly, so that complex data analysis and processing are avoided when the application is running, finally, the native application is constructed based on the native application tool chain, the native application can be generated without the application in the running process of the specific domain analysis in the running process, and therefore the performance of the native application in the running process is better.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the application or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a flowchart of a first embodiment of a native application generation method according to the present application;
FIG. 2 is a diagram illustrating low-code development provided by a first embodiment of a native application generation method of the present application;
FIG. 3 is a schematic diagram of a native application generation method according to the present application;
FIG. 4 is a schematic block diagram of a native application generation device according to an embodiment of the present application;
fig. 5 is a schematic device structure diagram of a hardware running environment related to a method for generating a native application in an embodiment of the present application.
The achievement of the objects, functional features and advantages of the present application will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the technical solution of the present application and are not intended to limit the present application.
For a better understanding of the technical solution of the present application, the following detailed description will be given with reference to the drawings and the specific embodiments.
The method comprises the steps of obtaining domain-specific language text of a user side, analyzing the domain-specific language text in a preset analyzer to obtain first domain-specific language text, generating a grammar structure tree of a target format based on the first domain-specific language text, generating application codes of corresponding native applications based on the grammar structure tree of the target format, wherein the native applications comprise at least one of webpage applications, weChat applet applications, android applications and apple applications, and constructing the application codes based on a preset native application tool chain to generate the native applications.
In this embodiment, for convenience of description, description will be made below with the identification terminal as the execution subject.
Currently, low code platforms dynamically parse code text in a domain-specific language to generate native applications while the application is running using a generic parser. Specifically, the generic parser parses domain-specific language code at application runtime to generate corresponding native code, thereby building a native application that is suitable for multiple platforms. This way of parsing domain-specific language text and generating native code at application runtime adds additional domain-specific language parsing steps compared to directly running native application code, resulting in unnecessary performance consumption. Especially when an application is started, the starting time is obviously increased by the analysis process, and the starting waiting time is further prolonged along with the increase of the complexity of the application. In general, the native applications generated by the current native application generation methods consume greater performance at runtime.
The method comprises the steps of firstly obtaining a domain specific language text, namely DSL text (the domain specific language text is used for describing a preset application component), of a user side, and analyzing the domain specific language text through a preset analyzer to obtain a first domain specific language text. By completing the analysis at the compiling period, the dynamic analysis of the language codes in the specific field during the running of the application is avoided, and therefore the performance consumption of the native application during the running is reduced. Then, a grammar structure tree in a target format is generated based on the first domain-specific language text so that a subsequent code generation process can be performed based on the explicit component information. Then, based on the grammar structure tree, the application code (at least one of a webpage application, a WeChat applet, an android application and an apple application) of the native application is quickly generated, so that complex data analysis and processing during application running are effectively avoided. In the process of generating the native application code, the terminal analyzer traverses the component nodes of the grammar structure tree, extracts the hierarchical relationship, style information and component behavior information of the components, and generates the corresponding native application code according to the information. And finally, based on the generated application code, completing the construction of the native application. The 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 grammar structure tree and the final application code generated during the generation process are optimized independently for each terminal.
It should be noted that, the execution body of the embodiment may be a computing service device having functions of data processing, network communication and program running, such as a tablet computer, a personal computer, a mobile phone, or an electronic device, a terminal, or the like capable of implementing the above functions. The present embodiment and the following embodiments will be described below with reference to a terminal.
Based on this, an embodiment of the present application provides a native application generating method, and referring to fig. 1, fig. 1 is a schematic flow chart of a first embodiment of the native application generating method of the present application.
In this embodiment, the native application generation method includes steps S10 to S40:
Step S10, acquiring a domain-specific language text of a user side, wherein the domain-specific language text comprises a special language text for describing a preset application component;
The user side refers to a visual application development platform, the domain-specific language is a script language for storing and representing a specific format of visual application, and the script language is stored in a text form to obtain domain-specific language text, and different visual development platforms generally design own specific domain-specific languages. Unlike general programming languages, domain specific languages are specific to a particular application scenario or domain, and have the characteristics of being more compact and easy to express domain concepts. The preset application component refers to a component which is edited by a user through a visual operation such as drag and drag from a component area to an application editing area by a visual application development platform, and the user can develop an application interface of an application by freely combining the components. The application components may include a button component, a text component, and a form component.
Optionally, the user operates the application component through the visual application development platform, further determines the application component which should be included in the native application which the user needs to develop, and obtains the domain-specific language text describing the application component in the visual application development platform.
For example, referring to fig. 2, in a low code development platform, a general application component such as a text component, a numerical component, an amount component, a mailbox component, a date component, a time component, a telephone component, a region component, a formula component, a check item component, a level component, a text composition component, and the like is provided, a developer is editing a form named as an order in a form design area, places the application component in the application editing area, performs form design, places a text component under a title of the form, places a menu component under an order type, places an add component under a sales consultant, places the menu component under a state, places the text component under a state cause and a state description, places the amount component under a total amount of an order under payment information of the form, places the formula component under a discount, places the amount component under the discount, and the like, modifies the application component at a form style, for example, the modification component is 1 column in the modification field is aligned at a top of a personal computer end, the modification field title is aligned at a top of a mobile end/web end, and finally obtains a form page. The terminal will obtain this low code platform for describing the domain-specific language text of the application components in this form page.
Step S20, analyzing the field specific language text in a preset analyzer to obtain a first field specific language text, and generating a grammar structure tree in a target format based on the first field specific language text;
It should be noted that the preset parser is a special parsing tool for processing and parsing a specific language in the field. The parser converts the domain-specific language text into an application-internal understandable data structure by parsing the grammar rules.
Alternatively, the parser may finally 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 representation generated by the parser during parsing that is typically used to describe the structure of domain-specific languages at a higher level. This format not only simplifies the definition of application components, but also provides a basis for the generation of application code for subsequent native applications. The target format is typically adapted to different platforms and application types, ensuring that component requirements on multi-terminal applications (e.g., web applications, weChat applet applications, android applications, apple applications, etc.) can be covered. Alternatively, the target format may be JSON format and XML format, and the application code of the multi-terminal native application can be generated by parsing and data converting the syntax structure tree of JSON and XML format. JSON (JavaScript Object Notation) is a lightweight data exchange format, easy to read and write, and widely used for data transmission. XML (eXtensible Markup Language) is a markup language describing structured data, which is organized and defined with tags.
Illustratively, assuming that there is a DSL text describing a simple interface containing a title and buttons, the parser will translate the DSL text into a format that is understandable inside the parser, typically a data structure (e.g., tree structure). The parser obtains the first domain specific language text by lexical analysis and grammatical analysis of the DSL text corresponding to the application component. Optionally, the first domain-specific language text is a more structured representation, such as text in JSON format or XML format, relative to the domain-specific language text. Finally, the first domain specific language text is converted into a data structure in JSON format or XML format, and the data structure is a tree structure, and has a layering sense and is more structured compared with the first domain specific language text. The first domain specific language text is the result of a preliminary parsing of the DSL text. It is a direct translation of DSL text, often containing information on components, properties and behavior, but still approximates the semantics of the original text. A syntax structure tree is a more hierarchical, structured representation of data. It not only contains information of components, attributes, etc., but also explicitly shows hierarchical relationship, attribute dependence, event binding, etc. among these components. The syntax structure tree may reflect the component tree structure of the application and be used for subsequent generation of code.
Step S30, generating application codes of corresponding native applications based on a grammar structure tree in a target format, wherein the native applications comprise at least one of web applications, weChat applet applications, android applications and apple applications;
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 be adapted to a specific requirement or use, and generally includes data conversion, structure mapping and semantic conversion. The native application refers to an application program obtained by application development using a development framework and technology provided by official defaults, such as an android application developed using Java or kotlin, an apple application developed using shift, a web application developed using exact or Vue, and a WeChat applet application developed using WXML, WXSS, and JavaScript.
It should be noted that, the generated application code is the code of the component interface (including each application component), the code of the service layer of the native application may be manually encoded by a developer, and the construction of the subsequent native application is realized based on the code of the component interface and the code of the service layer generated by the scheme. Java, kotlin, javaScript and the Swift are both programming languages, are applied to application development of different platforms, and have no specific semantic meaning. The fact and the Vue are application development frameworks, and have no specific semantic meaning, while the WXML and WXSS are markup language and style sheet language used for WeChat applet application development, and have no specific semantic meaning.
Specifically, based on the syntax structure tree in JSON and XML formats, the application code of the corresponding native application is generated from the information in the syntax structure tree.
Step S40, based on a preset native application tool chain, constructing application codes, and generating a native application.
It should be noted that, the preset native application tool chain refers to a standardized set of tools and technologies used for generating, building and deploying the native application, for example, webpack, xcode, etc., webpack and Xcode are building tools, and have no specific semantic meaning. These toolchains are typically provided by a native application development platform or operating system for compiling application code into an application program that can ultimately run on a particular platform. Build is the overall process of processing application code, resources, and configuration files into a final native application that can run on a particular platform. Specific platforms refer to specific environments or systems on which native applications or software will run, such as operating system platforms, web application platforms, specific application platforms (WeChat applets), and hardware platforms (mobile devices, desktop computers, and embedded devices), among others.
Specifically, in the construction process, the native application tool chain integrates application codes with related resource files (such as pictures, audio, configuration files and the like), and executable files or application packages meeting the requirements of a target platform are generated through steps of compiling, linking and the like. For example, for android applications, the build process compiles Java or Kotlin code into dex file and packages it into apk file, for apple applications, compiles Swift code into binary file and packages it into ipa file, for web applications, vue code and compact code are packaged into one web application, for WeChat applet applications, WXML, WXSS and JavaScript code are packaged into applet application packages.
It should be noted that, the dex file refers to a bytecode file in the android application, contains compiled Java or Kotlin codes, the apk file refers to an installation package of the android application, contains all codes, resource files and configuration information, and the ipa file refers to an installation package of the apple application program, and contains the compiled codes and resource files.
According to the method, firstly, the domain-specific language text of a user side, namely DSL text (wherein the domain-specific language text comprises a special language text for describing a preset application component) is obtained, the domain-specific language text is analyzed in a preset analyzer to obtain the first domain-specific language text, the analysis of the domain-specific language text in the analyzer is avoided when the application is running, the performance consumption of the native application in the running process is reduced, secondly, a grammar 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 performed based on clear application component information, and then, based on the grammar structure tree in the target format, the application code of the native application, such as application codes of at least one of a webpage application, a micro-communication applet application, an android application and an apple application, is generated quickly, so that complex data analysis and processing are avoided when the application is running, finally, the native application is constructed based on the native application tool chain, the native application can be generated without the application in the running process of the specific domain analysis in the running process, and therefore the performance of the native application in the running process is better.
In the second embodiment of the present application, the same or similar content as that of the first embodiment may be referred to the description above, and will not be repeated. Based on this, step S30 is based on the syntax structure tree of the target format, and the step of generating the application code of the corresponding native application further includes steps a31 to a32:
Step A31, traversing component nodes of a grammar structure tree, and obtaining hierarchical relation, style information and component behavior information of the component nodes, wherein the hierarchical relation comprises an organization structure of an application component in a to-be-generated native application, the style information comprises visual properties of the application component in the to-be-generated native application, and the component behavior information comprises interaction logic of the application component;
And step A32, generating application codes of the native application based on the hierarchical relationship, the style information and the component behavior information.
It should be noted that, the component nodes refer to basic units representing application components in the syntax structure tree, and each node includes detailed information about the application components, such as types, positions, parent-child relationships, visual styles, and interaction behaviors of the application components. The component nodes define the layout and functions of the components in the application through the attributes and the child nodes thereof, and are key data structures for constructing and rendering the application interface. Hierarchical relationships refer to organizational and hierarchical relationships that describe components in an application, such as parent-child relationships of application components and the order in which components are arranged in an interface. Style information refers to visual manifestations of the description component in an application, including color, font, margin, size, etc. attributes, for controlling the appearance and style of the component. Component behavior information refers to response behaviors and processing modes of the response behaviors, which are triggered by operations such as clicking, sliding and the like of a user and describe interaction logic and dynamic behaviors of the component.
Specifically, each component node of the grammar structure tree is firstly analyzed, and the hierarchical relationship of the component nodes is extracted, wherein the hierarchical relationship comprises the parent-child level of the component in the application and the position arrangement in the interface. And extracting style information, namely visual representation details of the component, such as background color, frame style, font size and the like, so as to ensure that the appearance of the component meets the design requirements. Component behavior information is then extracted, including the interaction logic and dynamic behavior of the component, such as operations in response to a user's clicks, drags, swipes, etc., and defines how to handle these operations to achieve the intended user experience. And summarizing the acquired hierarchical relationship, style information and component behavior information, and integrating the acquired hierarchical relationship, style information and component behavior information into corresponding application codes of the to-be-generated native application, thereby ensuring the correct display and interaction functions of the components in the native application.
In this embodiment, the hierarchical information, style information and component behavior information between application components are obtained by traversing and grammar structure tree, and the application code is generated by using the information with clear structure, so as to increase the generation speed of the application code.
In the third embodiment of the present application, the same or similar content as that of the first embodiment or the second embodiment can be referred to the description above, and the description is omitted. On the basis, the native application is a web application, and the step A32 of generating the application code of the native application based on the hierarchical relationship, the style information and the component behavior information comprises the steps A321-A324:
Step A321, analyzing the component hierarchy of the component nodes based on the hierarchical relationship, and mapping the component hierarchy into a hypertext markup language tag structure corresponding to the web page application;
It should be noted that, the web application is an application running in a browser, and any independent application program is not required to be installed, so that the web application can be accessed through the browser of the terminal. Hypertext markup language tags (HTML, full Hyper Text Markup Language) refer to the basic elements used to define the content and structure of a web page, such as tags < div >, < span >, < header >, etc., and Hypertext markup language tag structures refer to the hierarchical and structural relationships of tags in a web page. This structure defines the layout and organization of the web page content. Parsing refers to analyzing and processing hierarchical structure information of component nodes, and understanding positions and arrangement modes of components in a webpage application. Mapping refers to converting the analytic hierarchical relationship information into an HTML label structure, namely mapping the organization structure of the component into an HTML label suitable for webpage display and a nested relationship thereof.
In addition, tags such as < div >, < span >, < header > refer to HTML tags for constructing a web page structure, and have no actual semantic meaning.
Specifically, the hierarchical information is converted into corresponding HTML tags and nested levels thereof according to the hierarchical information of the component nodes, such as parent-child relationships and arrangement sequences, so as to construct the HTML structure of the application web page.
Step A322, analyzing the visual attribute of the component node based on the style information, and mapping the visual attribute into a cascading style sheet style rule corresponding to the webpage application;
it should be noted that, the visual attribute refers to an appearance feature of the component in the web application, such as color, font, margin, size, etc., for controlling a display style of the component. Cascading style sheets (CSS, full CASCADING STYLE SHEETS) refers to a language used to define web page content styles and layouts for specifying the appearance and layout of HTML tags. Cascading style sheet style rules refer to style specifications defined by the CSS for setting visual effects of web page elements.
Specifically, according to the style information of the component nodes, the style information is converted into corresponding CSS rules, the rules define the appearance and layout of the components in the webpage, such as setting styles of font colors, background colors, margins and the like, and the visual effect of the components is ensured to meet design requirements.
Step A323, analyzing the behavior logic of the component node based on the component behavior information, and mapping the behavior logic into script language codes corresponding to the webpage application;
It should be noted that behavior logic refers to dynamic response or operation behavior exhibited by a component during user interaction. Such as events triggered when a user clicks a button, style changes when a mouse hovers, processing logic after the input box content changes, etc. These behavioral logic define the manner in which the user interacts with the application and how the application updates its state or performs specific functions based on these interactions. Scripting language code refers to programming language code that is used to define and control dynamic behavior in web pages. Common scripting languages such as JavaScript can realize functions of event processing, data verification, animation effects, asynchronous data requests and the like in the web application by writing scripting language codes, and the scripting language codes enable the web application to have static contents and respond to user operations and to be updated dynamically.
Specifically, interaction rules or conditions contained in the component nodes are analyzed and converted into corresponding script language codes for controlling interaction operations in the webpage application.
And step A324, integrating the hypertext markup language tag structure, the cascading style sheet style rule and the script language code of the webpage application to obtain the application code of the native application.
It should be noted that integration refers to unified combination and coordination of various parts of the web application (i.e., the html tag structure, the cascading style sheet style rule, and the scripting language code), so that they together form a complete and executable web application. In the integration process, it is necessary to ensure that the dependency relationships, hierarchy structures and interaction logic of the different parts can all be correctly connected and executed, so as to generate the application code of the web page application.
Specifically, the integration includes taking the parsed HTML tag structure as the content and layout basis of the webpage, and associating CSS style rules into the corresponding HTML tags to achieve the visual effect of the webpage. The generated scripting language code is then embedded into the page to control user interactions and dynamic behavior. Through the integration, the complete webpage application code is finally obtained, the code not only contains static contents of the webpage, but also has dynamic interaction capability, and can be correctly rendered and operated in the webpage.
The content of the embodiment is one of the practical application scenarios of the scheme. Referring to fig. 3, when application development/editing is performed, application code of a web application is generated by parsing domain-specific language text during static compilation. Specifically, firstly, domain-specific language text of a user side is acquired, and the text is used for describing a preset application component. Then, parsing the domain-specific language text containing the domain-specific language in a preset parser to obtain a syntax structure tree in a target format, for example, JSON or XML format. Based on the grammar structure tree, corresponding native application codes are generated, wherein the native application codes comprise at least one of a webpage application, a WeChat applet application, an android application and an apple application. The generated web page application codes are integrated, wherein the hierarchical relation of the analysis component nodes is mapped into an HTML label structure, style information is mapped into CSS style rules, and behavior logic is mapped into script language codes. Finally, by integrating the HTML tag, CSS style and scripting language code, a complete Web application code is generated, which can be directly constructed using the native toolchain of the Web application, generating the front URL/Web static deployment package of the Web application (URL is a uniform resource locator, is a standard address on the internet for identifying and locating resources, and the Web is the Web page). It should be noted that, the HTML tag structure, the CSS style rule, and the script language code are the most basic native code for constructing the web application, for the syntax structure tree of the target format, the frame code for constructing the web application may also be resolved and generated, the frame for commonly constructing the web application has a exact frame and a Vue frame, the exact frame is an open source script language library for constructing the user interface, its core concept is componentized development, allowing the developer to split the interface into independent and reusable components, each component is responsible for rendering a part of its own interface, the Vue frame is an open source script language library, and is also used for constructing the user interface, unlike the exact, it is more focused on usability and development experience, the script language used by the Vue frame is JavaScript, and the script language of the exact frame is JSX (JSX is a semantic extension of JavaScript, JSX has no specific meaning). The webpage application generated by the scheme converts the language text of the specific field into the application code of the native webpage application before operation, and conversion is not needed when the application operates, so that the webpage application developed by adopting the low-code development platform becomes the real native webpage application, and the performance consumption of the webpage application during operation is effectively reduced.
In the fourth embodiment of the present application, the same or similar content as that of the first embodiment or the second embodiment can be referred to the description above, and the description is omitted. On the basis, the native application is a WeChat applet application, and the step A32 of generating an application code of the native application based on the hierarchical relationship, the style information and the component behavior information comprises the steps A331-A334:
step A331, analyzing the component hierarchy of the component nodes based on the hierarchical relationship, and mapping the component hierarchy into a structural label corresponding to the WeChat applet application;
the WeChat applet application is a built-in application that runs in the WeChat application of the terminal. The WeChat applet uses specific structure tags to define the layout and structure of the interface. Specifically, according to the hierarchical information of the component nodes, such as father-son relationship and arrangement order, the hierarchical information is converted into corresponding WeChat applet structure labels and nesting levels thereof, and the page structure of the applet is constructed.
And step A332, analyzing the visual attribute of the component node based on the style information, and mapping the component node into a style sheet corresponding to the WeChat applet.
Note that the WeChat applet uses WXSS to define the visual style of the component, including color, font, margins, etc. Specifically, according to the style information of the component node, the style information is converted into a corresponding WXSS style rule, and the WXSS style rule defines the appearance and layout of the component in the applet, so that the visual effect of the component is ensured to meet the design requirement.
Step A333, analyzing the behavior logic of the component node based on the component behavior information, and mapping the behavior logic into script language codes corresponding to the WeChat applet.
It should be noted that the WeChat applet uses a scripting language to handle the behavior logic of the component, including user interaction events (e.g., clicks, swipes, etc.). Specifically, the interaction rules or conditions contained in the component nodes are analyzed and converted into corresponding script language codes (such as Javascript codes) for controlling dynamic behaviors and user interactions in the WeChat applet.
And step A334, integrating the structural labels, style sheets and script language codes of the WeChat applet application to obtain the application code of the native application.
It should be noted that integration refers to the unified combination and coordination of various parts of the WeChat applet (i.e., the structural tag, the style sheet, and the scripting language code) to form a complete, executable applet. In the integration process, it is necessary to ensure that the dependency, hierarchy and interaction logic of the different parts can all be correctly connected and executed, so as to generate the application code of the WeChat applet. Specifically, the integration comprises taking the parsed WeChat applet structure label as the content and layout basis of the page, and associating WXSS style rules into the corresponding structure label to realize the visual effect of the page. The generated scripting language code is then embedded into the page to control user interactions and dynamic behavior. Through the integration, the complete WeChat applet application code is finally obtained, and the code not only contains static contents of pages, but also has dynamic interaction capability, and can be correctly rendered and operated in the WeChat applet.
The embodiment is one of the practical application scenarios of the present solution, referring to fig. 3, and when application development/editing is performed, during static compiling, an application code of a WeChat applet application is generated by parsing a domain-specific language text. Specifically, firstly, domain-specific language text of a user side is acquired, and the text is used for describing a preset application component. Then, parsing the domain-specific language text in a preset parser to obtain a grammar structure tree in a target format, such as JSON or XML format. Based on the grammar structure tree, corresponding native application codes of the WeChat applet are generated, wherein the native application codes comprise structure labels, style sheets and script language codes in the WeChat applet. The generated WeChat applet application code is integrated, and the hierarchical relation mapping of the parsing component nodes is structural labels, namely WXML, style information is mapped to WXSS style rules, and behavior logic is mapped to script language codes (namely js codes, js is short for Javascript). Finally, through integrating the structure labels, WXSS patterns and script language codes, a complete WeChat applet application code is generated, and the WeChat applet application code can be directly tested and issued in a WeChat developer tool to construct a page URL/Web static deployment package (URL is a uniform resource locator, is a standard address used for identifying and locating resources on the Internet, web is a webpage), and the specific language text in the field is not required to be analyzed when the WeChat applet application is operated through the page URL/Web static deployment package, so that the performance consumption of the WeChat applet application in operation is effectively reduced.
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 description above, and the description is omitted. On the basis, the native application is an android application, and the step A32 of generating the application code of the native application based on the hierarchical relationship, the style information and the component behavior information comprises the steps A341-A344:
Step A341, analyzing the hierarchical structure of the component node based on the hierarchical relationship, and mapping the hierarchical structure into an android layout file corresponding to the android application;
It should be noted that, the android application is an application program running on the android operating system, and is mainly used for various android devices, and the shopping software in the android mobile phone is an android Zhuo Ying application. The android layout file is used for defining the structure of the application interface and the arrangement mode of the components. Specifically, according to the hierarchical information of the component nodes, such as parent-child relationships and arrangement sequences, the hierarchical information is converted into each view element and nested relationship thereof in the android XML layout file format. Including converting the components to ViewGroup or View elements and specifying their location and layout properties according to the hierarchy.
An android XML layout file refers to a file for defining the structure of an android application interface, and uses an XML (extensible markup language) format to describe the arrangement, size, color, font, and other attributes of each view component in an application. The android XML layout file is analyzed and converted into an actual interface when the application is compiled and run, viewGroup and View elements refer to two types of core components in the android, and the two types of core components are used for the android application layout and have no actual semantic meaning.
Step A342, analyzing the visual attribute of the component node based on the style information, and mapping the visual attribute into an android style resource corresponding to the android application;
It should be noted that the android style resource is used to define visual effects of the component, such as color, font, margin, and the like. Specifically, according to the style information of the component nodes, the component nodes are converted into style rules in the android XML style resource file. The method comprises the steps of creating or updating style definitions in style. Xml files, and applying the styles to corresponding layout elements to ensure that the appearance of the assembly meets design requirements. The style. Xml file is a resource file for defining global styles in an android application, contains multiple style definitions, and is 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 for describing data, which organizes data by tags.
Step A343, analyzing the behavior logic of the component node based on the component behavior information, and mapping the behavior logic into a behavior code corresponding to the android application;
It should be noted that the behavior code of the android application is mainly used to define the interaction mode between the user and the application. Behavior logic includes operational events triggered by a user on an interface, such as clicking a button, sliding a screen, or entering text, and the reaction of an application is accomplished through event handling code.
Specifically, interaction rules defined in the component nodes are parsed and mapped into an android event listener or callback function. Common behavior codes include implementations of interfaces OnClickListener, onTouchListener, etc. to handle user clicks, touches, etc. According to the interaction requirement of each component, corresponding Java or Kotlin codes are generated, and behavior logic is embedded into corresponding active classes or fragment classes so as to ensure that the operation of a user can be correctly responded and processed.
In addition, onClickListener and OnTouchListener are interfaces for handling user interactions in Android development.
And step A344, integrating the layout information, the android style resources and the behavior codes in the android layout file of the android application to obtain the application code of the native application.
It should be noted that integration refers to unifying the generated layout file, style resource file and behavior code into a complete android application project, so as to ensure that they can cooperate in runtime. Specifically, the layout file is responsible for describing the hierarchical structure of the application interface, the appearance of the style resource control component, and the behavior code defines the interaction logic of the user. In the integration process, it is necessary to ensure that the references and bindings between layout, style and behavior codes are correct. For example, binding component identifications in the layout file with event handling in the behavior code ensures that the user can trigger the corresponding event when clicking a button. The finally generated Android application code can be imported into development environments such as Android Studio and the like for compiling, debugging and deployment, so that a complete Android application is formed.
In addition, android Studio is an integrated development environment designed specifically for Android development.
In the present embodiment, referring to fig. 3, when application development/editing is performed, application code of an android application is generated by parsing a domain-specific language text during static compilation. Specifically, firstly, domain-specific language text of a user side is acquired, and the text is used for describing a preset application component. Then, analyzing the text of the domain-specific language in a preset analyzer to obtain a grammar structure tree in an XML format. Based on the grammar structure tree, corresponding application codes of the Android application are generated, the application codes of the Android application can be compiled, debugged and deployed through Android Studio, an apk (Android Package) file is finally generated, after the apk file is installed, a user does not need to analyze language codes in a specific field when starting the Android application, performance consumption in running is reduced, and therefore the effect of better performance in running of the Android application is achieved.
In the sixth embodiment of the present application, the same or similar content as that of the first embodiment or the second embodiment can be referred to the description above, and the description is omitted. On the basis, the native application is an apple application, and the step A32 of generating the application code of the native application based on the hierarchical relationship, the style information and the component behavior information comprises the steps A351-A354:
Step A351, analyzing the hierarchical structure of the component nodes based on the hierarchical relationship, and mapping the hierarchical structure into a structural code corresponding to the apple application;
It should be noted that, the apple application is a native application program running on the apple device, and the apple application includes an apple social application. The structure code of the apple application refers to view hierarchy code in the shift, and is used for defining father-son relationship and layout structure of each view component in the interface. The Swift is parsed from the hierarchical relationship in the xml-format syntax structure tree, and is a programming language for apple application in native applications.
Specifically, the hierarchical relationship of the component nodes is analyzed, and the hierarchical relationship is mapped into corresponding apple application view codes.
For a certain form component, a text box sub-component is nested inside the form component, and the form component and the text box sub-component are mapped into corresponding apple application view codes by analyzing the hierarchical relationship of component nodes.
Step A352, analyzing the visual attribute of the component node based on the style information, and mapping the visual attribute into a style code corresponding to the apple application;
It should be noted that the style code of the apple application refers to a code for controlling the appearance of the component in the Swift. And generating corresponding apple application style codes according to the analyzed visual attributes of the component nodes. For example, by converting style information such as color, margin, font, etc. of the component into style attributes of the Swift modifier, it is ensured that the component appearance conforms to the original component appearance.
Step A353, analyzing the behavior logic of the component node based on the component behavior information, and mapping the behavior logic into behavior codes of the apple application;
It should be noted that, the behavior code of the apple application refers to the code of the control component interaction logic, and the user interaction behavior is generally realized through the attribute wrappers of Swift @ State, @ Binding, @ ObservedObject and the like. Specifically, the behavior logic of the parsing component, such as clicking, dragging, sliding and other user interaction operations, is converted into event processing codes corresponding to the Swift.
In addition, attribute wrappers such as @ State, @ Binding, @ ObservedObject and the like are tools used for managing view states and data flows in the shift, so that the view of the shift can automatically respond to State changes, and the State management and updating flow of the view is simplified.
Step A354, integrating the structure code, style code and behavior code of the apple application to obtain the native application code.
It should be noted that, integration refers to combining the generated structure code, style code and behavior code to generate a complete apple application code. This process ensures that view layers, visual styles, and user interactions can be properly rendered and executed on the apple device.
Specifically, the integration includes combining the view hierarchy in the shift with the modifier to form an executable apple application code file, and the development tool Xcode of the apple application compiles the apple application code file into an ipa file.
In addition, xcode is an integrated development environment that supports apple applications.
The embodiment is also one of practical application scenarios of the present solution, and referring to fig. 3, when application development/editing is performed, application codes of an apple application are generated by parsing domain-specific language text during static compiling. Specifically, firstly, domain-specific language text of a user side is acquired, and the text is used for describing a preset application component. Then, analyzing the text of the domain-specific language in a preset analyzer to obtain a grammar structure tree in an XML format. Based on the grammar structure tree, generating application codes of the corresponding apple application, analyzing the hierarchical relationship and style information of the component nodes, mapping contents such as form components, text boxes and buttons into a Swift view code, and realizing user interaction through behavior logic. After integration, the generated application code may be compiled by Xcode, and finally an executable apple application file, that is, an ipa (iOS App Store Package, apple application mall package) file is formed. The user does not need to analyze language texts in specific fields when running the ipa file, so that the performance consumption of the apple application in running is reduced, and the speed of the apple application in running is effectively improved.
It should be noted that the foregoing examples are only for understanding the present application, and are not meant to limit the method for generating the native application of the present application, and more forms of simple transformation based on the technical concept are all within the scope of the present application.
The present application also provides a native application generating device, please refer to fig. 4, which includes:
the text collection module 10 is configured to obtain a domain-specific language text of a user side, where the domain-specific language text includes a specific language text for describing a preset application component;
The text parsing module 20 is configured to parse the domain-specific language text in a preset parser to obtain a first domain-specific language text, and generate a grammar structure tree in a target format based on the first domain-specific language text;
the code generating module 30 is configured to generate application codes of corresponding native applications based on a syntax structure tree in a target format, where the native applications include at least one of a web application, a WeChat applet application, an android application, and an apple application;
the code packaging module 40 is configured to construct application codes based on a preset native application tool chain, and generate a native application.
The native application generating device provided by the application can solve the technical problem that the performance consumption of the native application generated by the current native application generating method is large during operation by adopting the native application generating method in the embodiment. Compared with the prior art, the method and the device for generating the native application have the advantages that the method for generating the native application has the same advantages as those of the method for generating the native application provided by the embodiment, and other technical features in the device for generating the native application are the same as those disclosed by the method of the embodiment, and are not repeated herein.
The application provides a native application generating device which comprises at least one processor and a memory in communication connection with the at least one processor, wherein the memory stores instructions executable 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 generating method in the first embodiment.
Referring now to FIG. 5, a diagram of a native application generation device suitable for use in implementing embodiments of the present application is shown. The native application generating device in the embodiment of the present application may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (Personal DIGITAL ASSISTANT: personal digital assistant), a PAD (Portable Application Description: tablet), a PMP (Portable MEDIA PLAYER: portable multimedia player), an in-vehicle terminal (e.g., an in-vehicle navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. The native application generating device shown in fig. 5 is only one example and should not impose any limitation on the functionality and scope of use of embodiments of the present application.
As shown in fig. 5, the native application generating apparatus may include a processing device 1001 (e.g., a central processor, a graphics processor, etc.), which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access Memory (RAM: random Access Memory) 1004. In the RAM1004, various programs and data required for the operation of the native application generating device are also stored. The processing device 1001, the ROM1002, and the RAM1004 are connected to each other by a bus 1005. An input/output (I/O) interface 1006 is also connected to the bus. In general, a system including an input device 1007 such as a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc., an output device 1008 including a Liquid crystal display (LCD: liquid CRYSTAL DISPLAY), a speaker, a vibrator, etc., a storage device 1003 including a magnetic tape, a hard disk, etc., and a communication device 1009 may be connected to the I/O interface 1006. The communication means 1009 may allow the native application generating device to communicate wirelessly or wired with other devices to exchange data. While a native application generating device having various systems is shown in the figures, it should be understood that not all of the illustrated systems are required to be implemented or provided. More or fewer systems may alternatively be implemented or provided.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through a communication device, or installed from the storage device 1003, or installed from the ROM 1002. The above-described functions defined in the method of the disclosed embodiment of the application are performed when the computer program is executed by the processing device 1001.
The native application generation equipment provided by the application can solve the technical problem of native application generation by adopting the native application generation method in the embodiment. Compared with the prior art, the beneficial effects of the native application generating device provided by the application are the same as those of the native application generating method provided by the above embodiment, and other technical features of the native application generating device are the same as those disclosed by the method of the above embodiment, and are not described in detail herein.
It is to be understood that portions of the present disclosure may be implemented in hardware, software, firmware, or a combination thereof. In the description of the above embodiments, particular features, structures, materials, or characteristics may be combined in any suitable manner in any one or more embodiments or examples.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
The present application provides a storage medium having computer-readable program instructions (i.e., a computer program) stored thereon for performing the native application generation method in the above-described embodiments.
The storage medium provided by the application can be, for example, a U disk, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, or device, or a combination of any of the foregoing. More specific examples of a computer-readable storage medium may include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access Memory (RAM: random Access Memory), a Read-Only Memory (ROM), an erasable programmable Read-Only Memory (EPROM: erasable Programmable Read Only Memory or flash Memory), an optical fiber, a portable compact disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this embodiment, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, or device. Program code embodied on a computer readable storage medium may be transmitted using any appropriate medium, including but not limited to electrical wiring, fiber optic cable, RF (Radio Frequency) and the like, or any suitable combination of the foregoing.
The storage medium may be contained in the native application generating apparatus or may exist alone without being assembled into the native application generating apparatus.
The storage medium is loaded with one or more programs, when the one or more programs are executed by a native application generating device, the native application generating device is caused to acquire domain-specific language text of a user side, wherein the domain-specific language text is a special language text for describing a preset application component, parse the domain-specific language text in a preset parser to obtain a first domain-specific language text, generate a grammar structure tree of a target format based on the first domain-specific language text, generate application codes of corresponding native applications based on the grammar structure tree of the target format, wherein the native applications comprise at least one of web applications, weChat applet applications, android applications and apple applications, and construct the application codes based on a preset native application tool chain to generate the native applications.
Computer program code for carrying out operations of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of remote computers, the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN: local Area Network) or a wide area network (WAN: wide Area Network), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present application may be implemented in software or in hardware. Wherein the name of the module does not constitute a limitation of the unit itself in some cases.
The storage medium provided by the application is a computer readable storage medium, and the computer readable storage medium stores computer readable program instructions (namely computer programs) for executing the native application generation method, so that the technical problem that the performance consumption of the native application generated by the current native application generation method is relatively high during operation can be solved. Compared with the prior art, the beneficial effects of the computer readable storage medium provided by the application are the same as those of the native application generating method provided by the above embodiment, and are not described herein.
The present application also provides a program product comprising a computer program which, when executed by a processor, implements the steps of a native application generation method as described above.
The computer program product provided by the application can solve the technical problem that the performance consumption of the native application generated by the current native application generation method is relatively large during running. Compared with the prior art, the beneficial effects of the computer program product provided by the application are the same as those of the native application generation method provided by the above embodiment, and are not described herein.
The foregoing description is only a partial embodiment of the present application, and is not intended to limit the scope of the present application, and all the equivalent structural changes made by the description and the accompanying drawings under the technical concept of the present application, or the direct/indirect application in other related technical fields are included in the scope of the present application.

Claims (9)

1. A method for generating a native application, the method comprising:
Acquiring a domain-specific language text of a user side, wherein the domain-specific language text comprises a special language text for describing a preset application component;
Analyzing the domain-specific language text in a preset analyzer to obtain a first domain-specific language text, and generating a grammar structure tree in a target format based on the first domain-specific language text, wherein the grammar structure tree comprises components, hierarchical relations among the components, attribute dependencies and event bindings, and the analyzer generates the first domain-specific language text through lexical analysis and grammar analysis according to grammar definitions of the specific domain-specific language text;
Generating application codes of corresponding native applications based on the grammar structure tree of the target format, wherein the native applications comprise web applications, weChat applet applications, android applications and apple applications, the application codes of the android applications are developed by using Java or kotlin, the application codes of the apple applications are developed by using shift, the application codes of the web applications are developed by using exact or Vue, and the application codes of the WeChat applet applications are developed by using WXML, WXSS and JavaScript;
Constructing the application code based on a preset native application tool chain to generate the native application, wherein the construction process compiles Java or Kotlin codes into a dex file and packages the dex file into a native application in an apk file format for the application code of the android application, compiles a Swift code into a binary file and packages the binary file into a native application in an ipa file format for the application code of the apple application, packages a Vue code and a compact code into a native application applied in a webpage for the application code of the webpage application, packages WXML, WXSS and JavaScript codes into native applications of applets for the application code of WeChat applets,
Wherein the step of generating application code of the corresponding native application based on the syntax structure tree of the target format comprises,
Traversing component nodes of the grammar structure tree, and acquiring hierarchical relation, style information and component behavior information of the component nodes, wherein the hierarchical relation comprises an organization structure of an application component in a to-be-generated native application, a parent-child relation of the application component and an arrangement sequence of the application component in an interface, the style information comprises visual attributes of the application component in the to-be-generated native application, the visual attributes are appearance characteristics of the description component in a webpage application, and the appearance characteristics comprise colors, fonts, margins and sizes, and the component behavior information comprises interaction logic of the application component;
Generating an application code of the native application based on the hierarchical relationship, the style information and the component behavior information, wherein the process of generating the native application comprises analyzing each component node of the grammar structure tree, extracting the hierarchical relationship of the component nodes, extracting the style information of the component nodes, extracting the component behavior information of the component nodes, and collecting the hierarchical relationship of the component nodes, the style information and the component behavior information.
2. The method of claim 1, wherein the native application is a web application, and the generating the application code of the native application based on the hierarchical relationship, style information, and component behavior information comprises:
Analyzing the component hierarchy of the component node based on the hierarchical relationship, and mapping the component hierarchy into a hypertext markup language tag structure corresponding to the web page application;
Based on the style information, analyzing the visual attribute of the component node, and mapping the visual attribute into a cascading style sheet style rule corresponding to the webpage application;
Analyzing behavior logic of the component node based on the component behavior information, and mapping the behavior logic into script language codes corresponding to the webpage application;
Integrating the hypertext markup language tag structure, cascading style sheet style rules and script language codes of the web page application to obtain the application code of the native application.
3. The method of claim 1, wherein the native application is a mini-applet application, and wherein generating application code for the native application based on the hierarchical relationship, style information, and component behavior information further comprises:
analyzing the component hierarchy of the component node based on the hierarchical relationship, and mapping the component hierarchy into a structure label corresponding to the WeChat applet application;
based on the style information, analyzing the visual attribute of the component node, and mapping the component node into a style sheet corresponding to the WeChat applet;
Analyzing behavior logic of the component node based on the component behavior information, and mapping the behavior logic into script language codes corresponding to the WeChat applet;
And integrating the structural labels, style sheets and script language codes of the WeChat applet application to obtain the application code of the native application.
4. The method of claim 1, wherein 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 comprises:
Analyzing the hierarchical structure of the component nodes based on the hierarchical relationship, and mapping the hierarchical structure into an android layout file corresponding to the android application;
Based on the style information, analyzing the visual attribute of the component node, and mapping the visual attribute into an android style resource corresponding to the android application;
analyzing behavior logic of the component node based on the component behavior information, and mapping the behavior logic into behavior codes corresponding to the android application;
Integrating the layout information, the android style resources and the behavior codes in the android layout file of the android application to obtain the application code of the native application.
5. The method of claim 1, wherein the native application is an apple application, and wherein generating application code for the native application based on the hierarchical relationship, style information, and component behavior information further comprises:
Analyzing the hierarchical structure of the component nodes based on the hierarchical relationship, and mapping the hierarchical structure into a structural code corresponding to the apple application;
based on the style information, analyzing the visual attribute of the component node, and mapping the visual attribute into a style code corresponding to the apple application;
Analyzing behavior logic of the component node based on the component behavior information, and mapping the behavior logic into behavior codes of the apple application;
and integrating the structure code, the style code and the behavior code of the apple application to obtain the application code of the native application.
6. A native application generation apparatus, the apparatus comprising:
the text collection module is used for obtaining a domain-specific language text of the user side, wherein the domain-specific language text comprises a special language text for describing a preset application component;
The text analysis module is used for analyzing the domain-specific language text in a preset analyzer to obtain a first domain-specific language text, and generating a grammar structure tree in a target format based on the first domain-specific language text, wherein the grammar structure tree comprises components, hierarchical relations among the components, attribute dependencies and event bindings, and the analyzer generates the first domain-specific language text through lexical analysis and grammatical analysis according to grammar definitions of the domain-specific language text;
A code generating module, configured to generate application codes of corresponding native applications based on a syntax structure tree of the target format, where the native applications include a web application, a micro-letter applet application, an android application, and an apple application, the application codes of the android application are developed using Java or kotlin, the application codes of the apple application are developed using Swift, the application codes of the web application are developed using exact or Vue, the application codes of the micro-letter applet application are developed using WXML, WXSS, and JavaScript, the generating of the application codes of the corresponding native applications based on the syntax structure tree of the target format includes traversing component nodes of the syntax structure tree, acquiring hierarchical relationships of the component nodes, style information and component behavior information, where the hierarchical relationships include an organization structure of the application components in the native applications to be generated and an arrangement order of the application components in an interface, the style information includes visual properties of the application components in the applications to be generated, the visual properties of the application components include visual properties of the application components, and the visual properties of the application components include a font size, and a font size of the application components; generating application codes of the native application based on the hierarchical relationship, the style information and the component behavior information, wherein the process of generating the native application comprises analyzing each component node of the grammar structure tree, extracting the hierarchical relationship of the component nodes, extracting the style information of the component nodes, extracting the component behavior information of the component nodes, collecting the hierarchical relationship of the component nodes, the style information and the component behavior information, analyzing behavior logic based on the component behavior information, wherein the behavior logic refers to dynamic response or operation behavior of the component in the user interaction process, and the dynamic response comprises a style dynamic response;
The code packaging module is used for constructing the application codes based on a preset native application tool chain to generate the native application, wherein Java or Kotlin codes are compiled into dex files and packaged into native applications in an apk file format in the construction process of the application codes of the android application, the shift codes are compiled into binary files and packaged into native applications in an ipa file format in the application codes of the apple application, the Vue codes and the exact codes are packaged into native applications applied in a webpage in the application codes of the webpage application, and WXML, WXSS and JavaScript codes are packaged into native applications of small programs in the application codes of the WeChat applet application.
7. A native application generating device, characterized in that the device comprises a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the native application generating 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, on which a computer program is stored, which computer program, when being executed by a processor, implements the steps of the native application generation method according to any one of claims 1 to 5.
9. A program product, characterized in that it comprises a computer program which, when executed by a processor, implements the steps of the native application generation method according to any one of claims 1 to 5.
CN202411413458.XA 2024-10-11 2024-10-11 Native application generation method, device, equipment, storage medium and program product Active CN118916016B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411413458.XA CN118916016B (en) 2024-10-11 2024-10-11 Native application generation method, device, equipment, storage medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411413458.XA CN118916016B (en) 2024-10-11 2024-10-11 Native application generation method, device, equipment, storage medium and program product

Publications (2)

Publication Number Publication Date
CN118916016A CN118916016A (en) 2024-11-08
CN118916016B true CN118916016B (en) 2025-03-07

Family

ID=93296462

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411413458.XA Active CN118916016B (en) 2024-10-11 2024-10-11 Native application generation method, device, equipment, storage medium and program product

Country Status (1)

Country Link
CN (1) CN118916016B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110990010A (en) * 2019-12-03 2020-04-10 锐捷网络股份有限公司 Software interface code generation method and device
CN114064040A (en) * 2021-11-30 2022-02-18 上海汇付数据服务有限公司 Terminal code automatic generation method and platform based on visual interface

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111813381A (en) * 2020-06-22 2020-10-23 北京字节跳动网络技术有限公司 Method, device, medium and electronic equipment for generating executable program in cross-platform mode
CN115599353A (en) * 2022-10-19 2023-01-13 星河智联汽车科技有限公司(Cn) Applet development method, device, equipment and storage medium
CN118349232A (en) * 2023-01-16 2024-07-16 京东科技信息技术有限公司 A front-end code generation method and device, and storage medium
CN116755667A (en) * 2023-05-22 2023-09-15 北京无代码科技有限公司 Low-code DSL language development method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110990010A (en) * 2019-12-03 2020-04-10 锐捷网络股份有限公司 Software interface code generation method and device
CN114064040A (en) * 2021-11-30 2022-02-18 上海汇付数据服务有限公司 Terminal code automatic generation method and platform based on visual interface

Also Published As

Publication number Publication date
CN118916016A (en) 2024-11-08

Similar Documents

Publication Publication Date Title
Heitkötter et al. Cross-platform model-driven development of mobile applications with md2
US9256401B2 (en) Editor visualization of symbolic relationships
CN111240684B (en) Cutting method and device of JS codes, medium and electronic equipment
CN105354013A (en) Application interface rendering method and apparatus
WO2014200783A1 (en) Automatic source code generation
Overson et al. Developing Web Components: UI from jQuery to Polymer
CN119045829A (en) Compiling method, compiling device, electronic equipment and readable storage medium
CN118916016B (en) Native application generation method, device, equipment, storage medium and program product
Sengupta et al. Getting Started with React
Johansson Introduction to computing with python
WO2023128793A1 (en) System and method for dynamically visualizing software elements
Johnson Programming in HTML5 with JavaScript and CSS3
Salonen Evaluation Of Ui Component Libraries In React Development
Colombo-Mendoza et al. Alexandria: a visual tool for generating multi-device rich internet applications
Stoeckle et al. A framework for visual notation exchange
Verma Visual Studio Extensibility Development
RU2799988C2 (en) System and method for dynamic visualization of software elements
Sun Practical application development with apprun
Kosower et al. Flowgen: Flowchart-based documentation for C++ codes
Phanouriou User interface markup language (uiml) draft specification
Jonna Learning PrimeFaces Extensions Development
Noble et al. Flex 4 Cookbook: Real-world recipes for developing Rich Internet Applications
Lepreux et al. Composition of user interfaces
CN117348871A (en) Template-based page control generation method and device
Nouri et al. Interactive, live mashup development through UI-oriented computing

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant