Source code processing method and system for low-code development platform
By parsing and converting Zion Schema files and generating functional component mapping tables and component instance trees, the problem of Zion Schema files not being able to run in a run-free environment is solved, and the flexibility and structural clarity of low-code applications are improved.
Patent Information
- Application Number
- CN202411090758.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-08-09
AI Technical Summary
Zion Schema files cannot be "written at one time and run multiple times" without the corresponding running environment, resulting in reduced flexibility of low-code applications.
By obtaining and parsing Zion Schema files, generating functional component descriptions and relationship tables, building functional component mapping tables and component instance trees, converting them into bytecode files that can be directly executed in the web environment, realizing recursive rendering and instantiation of components.
It realizes the existence of runtime code of source code files of low-code platforms on multiple platforms, reducing analysis and compilation overhead, and improving the flexibility and structural clarity of low-code applications.
Smart Images

Figure CN118626076B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a source code processing method and system for a low-code development platform. Background Art
[0002] In the field of low-code development, Schema files play a core role, providing a structured description for low-code applications. Take the low-code development platform Zion platform as an example. This is an intuitive WYSIWYG development environment that uses automatic code generation technology to allow non-technical users such as product managers and designers to independently develop and iterate cross-platform products without the assistance of engineers. Users can create and edit Zion Schema files through the visual editor in the Zed platform, the Zion product framework, which contains the metadata required to build Zion applications.
[0003] Currently, just as different programming languages require specific runtime environments (e.g. Figure 1 , JavaScript relies on the V8 or QuickJS engine, and Java.class files run on the Java runtime environment JRE). The reason why Java.class files can run on the Java runtime environment JRE is that the Java language editor can convert Java source code into Java.class files. Then, in the absence of a corresponding runtime environment, the compilation process of Zion Schema files faces challenges and cannot achieve the development vision of "write once, run everywhere", thereby reducing the flexibility of low-code applications. Summary of the invention
[0004] The embodiments of the present application provide a source code processing method and system for a low-code development platform. In order to have a basic understanding of some aspects of the disclosed embodiments, a simple summary is given below. This summary is not a general review, nor is it intended to identify key / important components or describe the scope of protection of these embodiments. Its only purpose is to present some concepts in a simple form as a preface to the detailed description that follows.
[0005] In a first aspect, an embodiment of the present application provides a source code processing method for a low-code development platform, the method comprising:
[0006] Get the original Zion Schema file of the target Zion application. The original Zion Schema file is edited by the user in the visual editor of the Zion product framework built into the low-code development platform.
[0007] Parse the Zion Schema file to generate the functional component description of the target Zion application and the relationship table corresponding to each component. The functional component description is used to define the properties and behaviors of each component in the target Zion application, and the relationship table is used to describe the hierarchical relationship and connection relationship of each component;
[0008] According to the functional component description, build the functional component mapping table of the target Zion application;
[0009] According to the functional component mapping table and the relationship table, each component is recursively rendered into a tree structure to obtain a component instance tree;
[0010] Convert the component instance tree into a bytecode file that can be directly executed in a web environment as the runtime code corresponding to the target Zion application.
[0011] Optionally, build a functional component mapping table for the target Zion application based on the functional component description, including:
[0012] An initial mapping table is constructed using Object or Map in JavaScript. The initial mapping table is used to store the mapping relationship between component identifiers and corresponding component implementations. The component implementation is the component implementation code or reference.
[0013] Based on the functional component description, obtain the component identifier, type, data attributes, and subcomponent reference list of each component from the original Zion Schema file;
[0014] According to the type, data attributes and reference list of subcomponents, the implementation code or reference of each component is constructed to obtain the component implementation of each component;
[0015] Establish a mapping relationship between the component identification of each component and the component implementation of each component to obtain a mapping entry of each component;
[0016] The mapping entry of each component is stored in the initial mapping table to obtain the functional component mapping table of the target Zion application.
[0017] Optionally, the functional component mapping table includes a mapping relationship between a component identifier of each component and a component implementation of each component, and the relationship table is used to describe the hierarchical relationship and connection relationship of each component;
[0018] According to the functional component mapping table and relationship table, each component is recursively rendered into a tree structure to obtain a component instance tree, including:
[0019] Create component nodes according to the hierarchical relationship of each component;
[0020] Generate a component tree for each component based on the component nodes and the connection relationship between each component;
[0021] Recursively traverse each target component node in the component tree;
[0022] For each target component node traversed, obtain the component identifier of each target component node;
[0023] From the mapping relationship, obtain the target component implementation corresponding to the component identifier of each target component node;
[0024] The target component is implemented, each target component node is instantiated, and a component instance tree is obtained.
[0025] Optionally, create component nodes based on the hierarchical relationship and connection relationship of each component, including:
[0026] Traverse the hierarchical relationship of each component to determine the root component and each subcomponent under the root component from each component;
[0027] Generate a root component node corresponding to the root component according to the root component and its component description information;
[0028] According to each sub-component and the component description information of each sub-component, a sub-component node corresponding to each sub-component is generated.
[0029] Optionally, the component nodes include root component nodes and subcomponent nodes;
[0030] According to the component nodes and the connection relationship between the components, the component tree of each component is generated, including:
[0031] Obtaining a pre-established initial information tree of tree structure;
[0032] According to the connection relationship of each component, determine the insertion position of each root component node and each subcomponent node in the initial information tree;
[0033] At the insertion position, each root component node and each subcomponent node are inserted to obtain a component tree of each component.
[0034] Optionally, convert the component instance tree into a bytecode file that can be directly executed in a web environment, including:
[0035] Traverse and obtain each target component instance in the component instance tree;
[0036] Get the instantiation source code of each target component instance;
[0037] Compile the instantiation source code of each target component instance to obtain the compilation intermediate result;
[0038] Perform semantic analysis on the compilation intermediate results to determine the calling version of each called function in the instantiation source code of each target component instance;
[0039] Identify a function with a unique calling version as a directly referenced function, and identify a function without a unique calling version as an indirect referenced function, to obtain the directly referenced function and the indirect referenced function of each target component instance;
[0040] Convert the directly referenced functions and indirect referenced functions of each target component instance into bytecode files that can be directly executed in the Web environment.
[0041] Optionally, convert the directly referenced functions and indirect referenced functions of each target component instance into bytecode files that can be directly executed in the Web environment, including:
[0042] Constructing a direct reference function call instruction corresponding to the direct reference function of each target component instance, and constructing an indirect reference function call instruction corresponding to the indirect reference function of each target component instance, to obtain a direct reference function call instruction set and an indirect reference function call instruction set of each target component instance;
[0043] The direct reference function call instruction set and the indirect reference function call instruction set of each target component instance are rendered in hypertext markup language to obtain a bytecode file that can be directly executed in a Web environment.
[0044] Optionally, construct a direct reference function call instruction corresponding to the direct reference function of each target component instance, including:
[0045] Get the executable file of the target Zion application;
[0046] Put all function identifiers of the directly referenced function of each target component instance into the execution file in sequence, and obtain the function offset of each directly referenced function in the execution file;
[0047] Generate a direct reference function call instruction corresponding to the direct reference function of each target component instance according to the function offset.
[0048] Optionally, obtain the instantiation source code of each target component instance, including:
[0049] Load the pre-stored mapping relationship between component instances and data storage paths;
[0050] Obtain the component data storage path corresponding to each component instance in the mapping relationship, and obtain the data storage path of each target component instance;
[0051] Based on the data storage path of each target component instance, obtain the instantiation source code corresponding to each target component instance.
[0052] In a second aspect, an embodiment of the present application provides a source code processing system for a low-code development platform, the system comprising:
[0053] The file acquisition module is used to obtain the original Zion Schema file of the target Zion application. The original Zion Schema file is edited by the user in the visual editor of the Zion product framework built into the low-code development platform;
[0054] The file parsing module is used to parse the Zion Schema file and generate the functional component description of the target Zion application and the relationship table corresponding to each component. The functional component description is used to define the properties and behaviors of each component in the target Zion application, and the relationship table is used to describe the hierarchical relationship and connection relationship of each component.
[0055] A mapping table construction module is used to construct a functional component mapping table of a target Zion application according to a functional component description;
[0056] The component rendering module is used to recursively render each component into a tree structure according to the functional component mapping table and the relationship table to obtain a component instance tree;
[0057] The instance tree conversion module is used to convert the component instance tree into a bytecode file that can be directly executed in the Web environment as the runtime code corresponding to the target Zion application.
[0058] The technical solution provided by the embodiments of the present application may have the following beneficial effects:
[0059] In the embodiments of the present application, on the one hand, the component instance tree of the present application comprehensively reflects the relationship and dependency between the root component and the subcomponents, so that the relevant content of each component can be orderly converted into a bytecode file that can be directly executed in the Web environment, so that the source code file of the low-code platform can also have corresponding runtime code, reducing the parsing and compilation overhead of each platform when running the low-code application, and achieving the goal of "write once, run in multiple places", thereby improving the flexibility of low-code applications; on the other hand, the present application recursively renders each component into a tree structure through a functional component mapping table and a relationship table. The functional component description defines the properties and behaviors of each component in the Zion application, and the relationship table describes the hierarchical relationship and connection relationship of each component, so that the rendered component instance tree can clearly represent the structure of the Zion application, which is easy to understand and maintain each component.
[0060] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0062] Figure 1 This is a schematic diagram of an operating environment corresponding to different languages provided in an embodiment of the present application;
[0063] Figure 2 It is a flow chart of a source code processing method for a low-code development platform provided in an embodiment of the present application;
[0064] Figure 3 This is a schematic diagram of the initial page of Zion, a low-code platform provided by this application;
[0065] Figure 4 It is a schematic diagram of an editing page of a visual editor provided by this application;
[0066] Figure 5 is a schematic diagram of a component editing page provided by this application;
[0067] Figure 6 It is a schematic diagram of a process of generating a component instance tree provided by this application;
[0068] Figure 7 It is a structural diagram of a source code processing system for a low-code development platform provided by this application;
[0069] Figure 8 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0070] The following description and the accompanying drawings sufficiently illustrate specific embodiments of the present application to enable those skilled in the art to practice them.
[0071] It should be clear that the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0072] When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of systems and methods consistent with some aspects of the present application as detailed in the attached claims.
[0073] In the description of the present application, it should be understood that the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances. In addition, in the description of the present application, unless otherwise specified, "multiple" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.
[0074] The present application provides a source code processing method and system for a low-code development platform to solve the problems existing in the above-mentioned related technical issues. In the embodiments of the present application, on the one hand, the component instance tree of the present application fully reflects the relationship and dependency between the root component and the subcomponents, so the relevant content of each component can be orderly converted into a bytecode file that can be directly executed in the Web environment, so that the source code file of the low-code platform can also have corresponding runtime code, reducing the parsing and compilation overhead of each platform when running the low-code application, and achieving the goal of "write once, run in multiple places", thereby improving the flexibility of the low-code application program; on the other hand, the present application recursively renders each component into a tree structure through a functional component mapping table and a relationship table. The functional component description defines the properties and behaviors of each component in the Zion application, and the relationship table describes the hierarchical relationship and connection relationship of each component, so that the rendered component instance tree can clearly represent the structure of the Zion application, which is easy to understand and maintain each component. The following uses an exemplary embodiment for detailed description.
[0075] The following will be combined with the attached Figure 2 -Attached Figure 6 , a source code processing method for a low-code development platform provided in an embodiment of the present application is introduced in detail. The method can be implemented by a computer program and can be run on a source code processing system for a low-code development platform based on the von Neumann system. The computer program can be integrated into an application or run as an independent tool application.
[0076] See also Figure 2 , which is a flow chart of a source code processing method for a low-code development platform provided in an embodiment of the present application. Figure 2 As shown, the method of the embodiment of the present application may include the following steps:
[0077] S101, obtaining an original Zion Schema file of a target Zion application, where the original Zion Schema file is edited by a user in a visual editor of a Zion product framework built into a low-code development platform;
[0078] Among them, the target Zion application refers to a specific application that is to be developed or has been developed. It is built based on the Zion product framework. This application is a website, mobile application or other type of software product. The original Zion Schema file is a metadata file that describes the structure and behavior of the target Zion application. It contains all the necessary information of the application, such as component definition, data model, user interface layout, etc. The low-code development platform is the Zion platform. Developers can create applications by dragging and dropping components, setting properties and defining logic. The Zion product framework is a set of tools and component libraries built into the low-code development platform, specifically for building Zion applications. It provides a set of standardized methods to define and implement application functions. The visual editor is a tool in the low-code development platform that allows users to edit and design applications through a graphical interface. Users can add components, adjust layouts, configure data interfaces, etc. in the editor.
[0079] In the embodiment of the present application, the developer, for example, Figure 3 In the low-code development platform shown, you can enter the visual editor by triggering the "Start Building" function. You can create a new Zion application project in the visual editor. The visual editor is as follows: Figure 4 As shown, you can use the drag-and-drop function in the editor to add necessary components, such as product display lists, shopping carts, user login forms, etc. Component selection is as follows: Figure 5 As shown in the figure, the developer also configured the data model of the application, defined the relationship between entities such as products, users, and orders, and set the layout and style of the application through the visual editor. After editing, the developer saved the edited data, and the Zion platform generated a raw Zion Schema file. This file contains all the definition and configuration information of the application.
[0080] S102, parsing the Zion Schema file to generate a functional component description of the target Zion application and a relationship table corresponding to each component, wherein the functional component description is used to define the properties and behaviors of each component in the target Zion application, and the relationship table is used to describe the hierarchical relationship and connection relationship of each component;
[0081] Among them, the properties of each component in the Zion application include the size, color, position, etc. of the component, and the behaviors of each component in the Zion application include user interaction response, data processing logic, etc.; the hierarchical relationship refers to the nested structure of components, specifically the parent-child relationship between components. For example, a page component may contain multiple container components, and these container components may contain text components or other types of components. The connection relationship describes the data flow and event transmission between components. For example, a click event of a button component may trigger a data update of another component.
[0082] In some embodiments of the present application, developers can Figure 4 The visual editor shown, combined with Figure 5 The component editing panel designs the layout of the dashboard, including the navigation bar, chart components, data tables, and warning information components. For each component, the developer defines the necessary properties (such as the color scheme of the chart, the column configuration of the data table) and behaviors (such as displaying detailed information when clicking the chart). In the editor, the developer determines the hierarchical relationship between components. For example, the navigation bar is located at the top of the page, while the chart component and the data table are subcomponents of the page. After the development is completed, the Zion Schema file can be obtained. The system automatically parses the Zion Schema file, extracts the properties and behaviors of each component, and generates a functional component description. At the same time, a relationship table is generated to record the parent-child hierarchy and event connection relationship between components.
[0083] S103, constructing a functional component mapping table of the target Zion application according to the functional component description;
[0084] In an embodiment of the present application, the process of constructing a functional component mapping table of a target Zion application according to a functional component description specifically includes: constructing an initial mapping table using Object or Map in JavaScript, the initial mapping table being used to store a mapping relationship between a component identifier and a corresponding component implementation, the component implementation being an implementation code or reference of the component; obtaining the component identifier, type, data attributes, and reference list of subcomponents of each component from the original Zion Schema file based on the functional component description; constructing the implementation code or reference of each component according to the type, data attributes, and reference list of subcomponents to obtain the component implementation of each component; establishing a mapping relationship between the component identifier of each component and the component implementation of each component to obtain a mapping entry for each component; storing the mapping entry of each component in the initial mapping table to obtain a functional component mapping table of the target Zion application.
[0085] Among them, Object or Map is a data structure used to store key-value pairs in JavaScript. In this application, it is used to build an initial mapping table to store the mapping relationship between component identifiers and component implementations. The initial mapping table is a data structure used to store the mapping relationship between component identifiers (such as a unique ID or name) and corresponding component implementations. The component implementation can be the component's implementation code or a reference to the implementation. The functional component mapping table stores a mapping table of all mapping entries, which will be used for the construction of Zion applications and the search and instantiation of runtime components.
[0086] In the embodiment of the present application, by using the mapping table, the corresponding component implementation can be quickly found through the component identification, which greatly improves the efficiency of component search and management. At the same time, the mapping relationship between the component implementation and the identification is clearly recorded in the mapping table, making the code structure clearer and easier to maintain and update.
[0087] S104, recursively rendering each component into a tree structure according to the functional component mapping table and the relationship table to obtain a component instance tree;
[0088] The functional component mapping table includes a mapping relationship between a component identification of each component and a component implementation of each component, and the relationship table is used to describe the hierarchical relationship and connection relationship of each component.
[0089] In some embodiments of the present application, each component is recursively rendered into a tree structure according to a functional component mapping table and a relationship table, and the specific process of obtaining a component instance tree includes: creating component nodes according to the hierarchical relationship of each component; generating a component tree of each component according to the component nodes and the connection relationship of each component; recursively traversing each target component node in the component tree; for each target component node traversed, obtaining the component identifier of each target component node; obtaining the target component implementation corresponding to the component identifier of each target component node from the mapping relationship; and using the target component implementation to instantiate each target component node to obtain a component instance tree.
[0090] For example Figure 6 As shown, Figure 6 This is a schematic diagram of a process for generating a component instance tree provided by the present application. The component instance tree can be generated through the hierarchical relationship of each component.
[0091] Among them, the component node is the data structure of a single component, which usually contains the component's identification, type, attributes and other information. The component node is the basic unit for building a component tree. The component tree is a tree structure composed of component nodes in a hierarchical relationship, representing the component structure of the entire application. The target component node is the component node accessed during the recursive traversal process, and these nodes are the focus of the instantiation process. Recursive traversal is an algorithm for traversing a tree structure, starting from the root node and visiting each node in depth-first order. The component identifier is used to uniquely identify a component value, usually a string or a number. The component implementation is the specific implementation code or object, which can be a function, a class instance, or any executable code block.
[0092] The component instance tree of this application fully reflects the relationship and dependency between the root component and the sub-components. Therefore, the relevant content of each component can be converted into bytecode files that can be directly executed in the Web environment in an orderly manner, so that the source code files of the low-code platform can also have corresponding runtime codes, reducing the parsing and compilation overhead of each platform when running low-code applications, and achieving the goal of "write once, run in multiple places", thereby improving the flexibility of low-code applications.
[0093] In some embodiments of the present application, the specific process of creating a component node according to the hierarchical relationship and connection relationship of each component includes: traversing the hierarchical relationship of each component to determine the root component and each subcomponent under the root component from each component; generating a root component node corresponding to the root component according to the root component and the component description information of the root component; generating a subcomponent node corresponding to each subcomponent according to each subcomponent and the component description information of each subcomponent.
[0094] The component nodes include root component nodes and sub-component nodes.
[0095] In some embodiments of the present application, the specific process of generating a component tree of each component based on component nodes and the connection relationship between each component includes: obtaining a pre-established initial information tree of a tree structure; determining the insertion position of each root component node and each sub-component node in the initial information tree based on the connection relationship between each component; and inserting each root component node and each sub-component node at the insertion position to obtain a component tree of each component.
[0096] S105, converting the component instance tree into a bytecode file that can be directly executed in a Web environment as a runtime code corresponding to the target Zion application.
[0097] Among them, bytecode files are a low-level programming language, usually generated by a compiler or translator, and then executed by a virtual machine or interpreter. In Web development, bytecode files can be directly executed by the browser to improve performance. The Web environment refers to the platform that runs Web applications, usually a browser, or it may be a Node.js environment on the server side.
[0098] In an embodiment of the present application, the specific process of converting a component instance tree into a bytecode file that can be directly executed in a Web environment includes: traversing and obtaining each target component instance in the component instance tree; obtaining the instantiation source code of each target component instance; compiling the instantiation source code of each target component instance to obtain a compilation intermediate result; performing semantic analysis on the compilation intermediate result to determine the calling version of each called function in the instantiation source code of each target component instance; identifying a function that has a unique calling version as a directly referenced function, and identifying a function that does not have a unique calling version as an indirect referenced function, to obtain the directly referenced function and the indirect referenced function of each target component instance; converting the directly referenced function and the indirect referenced function of each target component instance into a bytecode file that can be directly executed in a Web environment.
[0099] Specifically, the specific process of converting the direct reference function and the indirect reference function of each target component instance into a bytecode file that can be directly executed in a Web environment includes: constructing the direct reference function call instructions corresponding to the direct reference function of each target component instance, and constructing the indirect reference function call instructions corresponding to the indirect reference function of each target component instance, to obtain the direct reference function call instruction set and the indirect reference function call instruction set of each target component instance; rendering the direct reference function call instruction set and the indirect reference function call instruction set of each target component instance in hypertext markup language to obtain a bytecode file that can be directly executed in a Web environment.
[0100] Specifically, the specific process of constructing the direct reference function call instruction corresponding to the direct reference function of each target component instance includes: obtaining the execution file of the target Zion application; placing all function identifiers in the direct reference function of each target component instance in the execution file in turn, and obtaining the function offset of each direct reference function in the execution file; based on the function offset, generating the direct reference function call instruction corresponding to the direct reference function of each target component instance.
[0101] Specifically, the specific process of obtaining the instantiation source code of each target component instance includes: loading the pre-stored mapping relationship between component instances and data storage paths; obtaining the component data storage path corresponding to each component instance in the mapping relationship, and obtaining the data storage path of each target component instance; based on the data storage path of each target component instance, obtaining the instantiation source code corresponding to each target component instance.
[0102] Furthermore, after obtaining the runtime code corresponding to the target Zion application, the runtime code can be deployed and run in the web environment of any platform.
[0103] In the embodiments of the present application, on the one hand, the component instance tree of the present application comprehensively reflects the relationship and dependency between the root component and the subcomponents, so that the relevant content of each component can be orderly converted into a bytecode file that can be directly executed in the Web environment, so that the source code file of the low-code platform can also have corresponding runtime code, reducing the parsing and compilation overhead of each platform when running the low-code application, and achieving the goal of "write once, run in multiple places", thereby improving the flexibility of low-code applications; on the other hand, the present application recursively renders each component into a tree structure through a functional component mapping table and a relationship table. The functional component description defines the properties and behaviors of each component in the Zion application, and the relationship table describes the hierarchical relationship and connection relationship of each component, so that the rendered component instance tree can clearly represent the structure of the Zion application, which is easy to understand and maintain each component.
[0104] The following is a system embodiment of the present application, which can be used to execute the method embodiment of the present application. For details not disclosed in the system embodiment of the present application, please refer to the method embodiment of the present application.
[0105] See also Figure 7 , which shows a schematic diagram of the structure of a source code processing system for a low-code development platform provided by an exemplary embodiment of the present application. The source code processing system for a low-code development platform can be implemented as all or part of an electronic device through software, hardware, or a combination of both. The system 1 includes a file acquisition module 10, a file parsing module 20, a mapping table construction module 30, a component rendering module 40, and an instance tree conversion module 50.
[0106] A file acquisition module 10 is used to acquire an original Zion Schema file of a target Zion application, where the original Zion Schema file is edited by a user in a visual editor of a Zion product framework built into a low-code development platform;
[0107] A file parsing module 20, used to parse the Zion Schema file, generate a functional component description of the target Zion application and a relationship table corresponding to each component, wherein the functional component description is used to define the properties and behaviors of each component in the target Zion application, and the relationship table is used to describe the hierarchical relationship and connection relationship of each component;
[0108] A mapping table construction module 30, used to construct a functional component mapping table of a target Zion application according to the functional component description;
[0109] The component rendering module 40 is used to recursively render each component into a tree structure according to the functional component mapping table and the relationship table to obtain a component instance tree;
[0110] The instance tree conversion module 50 is used to convert the component instance tree into a bytecode file that can be directly executed in the Web environment as the runtime code corresponding to the target Zion application.
[0111] It should be noted that the source code processing system for a low-code development platform provided in the above embodiment only uses the division of the above-mentioned functional modules as an example when executing the source code processing method for a low-code development platform. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the source code processing system for a low-code development platform provided in the above embodiment and the source code processing method embodiment for a low-code development platform belong to the same concept. The implementation process is detailed in the method embodiment, which will not be repeated here.
[0112] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0113] In the embodiments of the present application, on the one hand, the component instance tree of the present application comprehensively reflects the relationship and dependency between the root component and the subcomponents, so that the relevant content of each component can be orderly converted into a bytecode file that can be directly executed in the Web environment, so that the source code file of the low-code platform can also have corresponding runtime code, reducing the parsing and compilation overhead of each platform when running the low-code application, and achieving the goal of "write once, run in multiple places", thereby improving the flexibility of low-code applications; on the other hand, the present application recursively renders each component into a tree structure through a functional component mapping table and a relationship table. The functional component description defines the properties and behaviors of each component in the Zion application, and the relationship table describes the hierarchical relationship and connection relationship of each component, so that the rendered component instance tree can clearly represent the structure of the Zion application, which is easy to understand and maintain each component.
[0114] The present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the source code processing method for a low-code development platform of the above-mentioned various method embodiments.
[0115] See also Figure 8 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8 As shown, the electronic device 1000 may include: at least one processor 1001 , at least one network interface 1004 , a user interface 1003 , a memory 1005 , and at least one communication bus 1002 .
[0116] The communication bus 1002 is used to realize the connection and communication between these components.
[0117] The user interface 1003 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 1003 may also include a standard wired interface and a wireless interface.
[0118] The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0119] Among them, the processor 1001 may include one or more processing cores. The processor 1001 uses various interfaces and lines to connect various parts of the entire electronic device 1000, and executes various functions and processes data of the electronic device 1000 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1005, and calling data stored in the memory 1005. Optionally, the processor 1001 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 1001 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 1001, and it can be implemented separately through a chip.
[0120] Among them, the memory 1005 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 1005 includes a non-transitory computer-readable storage medium. The memory 1005 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 1005 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 1005 may also be optionally at least one storage system located away from the aforementioned processor 1001. As Figure 8 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a source code processing application for a low-code development platform.
[0121] exist Figure 8 In the electronic device 1000 shown, the user interface 1003 is mainly used to provide an input interface for the user and obtain data input by the user; and the processor 1001 can be used to call the source code processing application for the low-code development platform stored in the memory 1005, and specifically perform the following operations:
[0122] Get the original Zion Schema file of the target Zion application. The original Zion Schema file is edited by the user in the visual editor of the Zion product framework built into the low-code development platform.
[0123] Parse the Zion Schema file to generate the functional component description of the target Zion application and the relationship table corresponding to each component. The functional component description is used to define the properties and behaviors of each component in the target Zion application, and the relationship table is used to describe the hierarchical relationship and connection relationship of each component;
[0124] According to the functional component description, build the functional component mapping table of the target Zion application;
[0125] According to the functional component mapping table and the relationship table, each component is recursively rendered into a tree structure to obtain a component instance tree;
[0126] Convert the component instance tree into a bytecode file that can be directly executed in a web environment as the runtime code corresponding to the target Zion application.
[0127] In one embodiment, when the processor 1001 constructs a functional component mapping table of a target Zion application according to the functional component description, the processor 1001 specifically performs the following operations:
[0128] An initial mapping table is constructed using Object or Map in JavaScript. The initial mapping table is used to store the mapping relationship between component identifiers and corresponding component implementations. The component implementation is the component implementation code or reference.
[0129] Based on the functional component description, obtain the component identifier, type, data attributes, and subcomponent reference list of each component from the original Zion Schema file;
[0130] According to the type, data attributes and reference list of subcomponents, the implementation code or reference of each component is constructed to obtain the component implementation of each component;
[0131] Establish a mapping relationship between the component identification of each component and the component implementation of each component to obtain a mapping entry of each component;
[0132] The mapping entry of each component is stored in the initial mapping table to obtain the functional component mapping table of the target Zion application.
[0133] In one embodiment, when the processor 1001 recursively renders each component into a tree structure according to the functional component mapping table and the relationship table to obtain a component instance tree, the processor 1001 specifically performs the following operations:
[0134] Create component nodes according to the hierarchical relationship of each component;
[0135] Generate a component tree for each component based on the component nodes and the connection relationship between each component;
[0136] Recursively traverse each target component node in the component tree;
[0137] For each target component node traversed, obtain the component identifier of each target component node;
[0138] From the mapping relationship, obtain the target component implementation corresponding to the component identifier of each target component node;
[0139] The target component is implemented, each target component node is instantiated, and a component instance tree is obtained.
[0140] In one embodiment, when the processor 1001 creates a component node according to the hierarchical relationship and connection relationship of each component, the processor 1001 specifically performs the following operations:
[0141] Traverse the hierarchical relationship of each component to determine the root component and each subcomponent under the root component from each component;
[0142] Generate a root component node corresponding to the root component according to the root component and its component description information;
[0143] According to each sub-component and the component description information of each sub-component, a sub-component node corresponding to each sub-component is generated.
[0144] In one embodiment, when the processor 1001 generates a component tree of each component according to the component nodes and the connection relationship between each component, the processor 1001 specifically performs the following operations:
[0145] Obtaining a pre-established initial information tree of tree structure;
[0146] According to the connection relationship of each component, determine the insertion position of each root component node and each subcomponent node in the initial information tree;
[0147] At the insertion position, each root component node and each subcomponent node are inserted to obtain a component tree of each component.
[0148] In one embodiment, when the processor 1001 converts the component instance tree into a bytecode file that can be directly executed in a Web environment, the processor 1001 specifically performs the following operations:
[0149] Traverse and obtain each target component instance in the component instance tree;
[0150] Get the instantiation source code of each target component instance;
[0151] Compile the instantiation source code of each target component instance to obtain the compilation intermediate result;
[0152] Perform semantic analysis on the compilation intermediate results to determine the calling version of each called function in the instantiation source code of each target component instance;
[0153] Identify a function with a unique calling version as a directly referenced function, and identify a function without a unique calling version as an indirect referenced function, to obtain the directly referenced function and the indirect referenced function of each target component instance;
[0154] Convert the directly referenced functions and indirect referenced functions of each target component instance into bytecode files that can be directly executed in the Web environment.
[0155] In one embodiment, when the processor 1001 converts the directly referenced functions and the indirect referenced functions of each target component instance into a bytecode file that can be directly executed in a Web environment, the processor 1001 specifically performs the following operations:
[0156] Constructing a direct reference function call instruction corresponding to the direct reference function of each target component instance, and constructing an indirect reference function call instruction corresponding to the indirect reference function of each target component instance, to obtain a direct reference function call instruction set and an indirect reference function call instruction set of each target component instance;
[0157] The direct reference function call instruction set and the indirect reference function call instruction set of each target component instance are rendered in hypertext markup language to obtain a bytecode file that can be directly executed in a Web environment.
[0158] In one embodiment, when executing the direct reference function call instruction corresponding to the direct reference function of each target component instance, the processor 1001 specifically performs the following operations:
[0159] Get the executable file of the target Zion application;
[0160] Put all function identifiers of the directly referenced function of each target component instance into the execution file in sequence, and obtain the function offset of each directly referenced function in the execution file;
[0161] Generate a direct reference function call instruction corresponding to the direct reference function of each target component instance according to the function offset.
[0162] In one embodiment, when the processor 1001 executes to obtain the instantiation source code of each target component instance, the processor 1001 specifically performs the following operations:
[0163] Load the pre-stored mapping relationship between component instances and data storage paths;
[0164] Obtain the component data storage path corresponding to each component instance in the mapping relationship, and obtain the data storage path of each target component instance;
[0165] Based on the data storage path of each target component instance, obtain the instantiation source code corresponding to each target component instance.
[0166] In the embodiments of the present application, on the one hand, the component instance tree of the present application comprehensively reflects the relationship and dependency between the root component and the subcomponents, so that the relevant content of each component can be orderly converted into a bytecode file that can be directly executed in the Web environment, so that the source code file of the low-code platform can also have corresponding runtime code, reducing the parsing and compilation overhead of each platform when running the low-code application, and achieving the goal of "write once, run in multiple places", thereby improving the flexibility of low-code applications; on the other hand, the present application recursively renders each component into a tree structure through a functional component mapping table and a relationship table. The functional component description defines the properties and behaviors of each component in the Zion application, and the relationship table describes the hierarchical relationship and connection relationship of each component, so that the rendered component instance tree can clearly represent the structure of the Zion application, which is easy to understand and maintain each component.
[0167] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program for source code processing of the low-code development platform can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium of the program for source code processing of the low-code development platform can be a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0168] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A source code processing method for a low-code development platform, characterized in that: The method comprises: Obtain the original Zion Schema file of the target Zion application, where the original Zion Schema file is edited by the user in a visual editor of the Zion product framework built into the low-code development platform; Parse the Zion Schema file to generate a functional component description of the target Zion application and a relationship table corresponding to each component, wherein the functional component description is used to define the properties and behaviors of each component in the target Zion application, and the relationship table is used to describe the hierarchical relationship and connection relationship of each component; According to the functional component description, a functional component mapping table of the target Zion application is constructed; wherein, The step of constructing a functional component mapping table of the target Zion application according to the functional component description includes: An initial mapping table is constructed using Object or Map in JavaScript, wherein the initial mapping table is used to store a mapping relationship between a component identifier and a corresponding component implementation, wherein the component implementation is an implementation code or reference of the component; Based on the functional component description, obtain the component identifier, type, data attributes and subcomponent reference list of each component from the original Zion Schema file; According to the type, data attributes and reference list of subcomponents, construct implementation code or reference of each component to obtain component implementation of each component; Establish a mapping relationship between the component identification of each component and the component implementation of each component to obtain a mapping entry of each component; Storing the mapping entry of each component in the initial mapping table to obtain a functional component mapping table of the target Zion application; According to the functional component mapping table and the relationship table, recursively render the components into a tree structure to obtain a component instance tree; The component instance tree is converted into a bytecode file that can be directly executed in a Web environment as the runtime code corresponding to the target Zion application.
2. The method according to claim 1, characterized in that The functional component mapping table includes a mapping relationship between a component identifier of each component and a component implementation of each component, and the relationship table is used to describe the hierarchical relationship and connection relationship of the components; The components are recursively rendered into a tree structure according to the functional component mapping table and the relationship table to obtain a component instance tree, including: Creating component nodes according to the hierarchical relationship of the components; Generate a component tree of each component according to the component nodes and the connection relationship between the components; Recursively traverse each target component node in the component tree; For each target component node traversed, obtain the component identifier of each target component node; From the mapping relationship, obtain the target component implementation corresponding to the component identifier of each target component node; The target component is implemented by instantiating each target component node to obtain a component instance tree.
3. The method according to claim 2, characterized in that The creating component nodes according to the hierarchical relationship and connection relationship of the components includes: Traversing the hierarchical relationship of the components to determine the root component and each subcomponent under the root component from the components; Generate a root component node corresponding to the root component according to the root component and the component description information of the root component; According to the sub-components and the component description information of the sub-components, sub-component nodes corresponding to the sub-components are generated.
4. The method according to claim 2, characterized in that: The component nodes include root component nodes and sub-component nodes; The generating a component tree of each component according to the component node and the connection relationship between the components includes: Obtaining a pre-established initial information tree of tree structure; Determining the insertion positions of the root component nodes and the subcomponent nodes in the initial information tree according to the connection relationship of the components; At the insertion position, each root component node and each sub-component node are inserted to obtain a component tree of each component.
5. The method according to claim 1, characterized in that The step of converting the component instance tree into a bytecode file that can be directly executed in a Web environment includes: Traverse and obtain each target component instance in the component instance tree; Obtaining the instantiation source code of each target component instance; Compiling the instantiation source code of each target component instance to obtain a compilation intermediate result; Performing semantic analysis on the compilation intermediate result to determine the calling version of each called function in the instantiation source code of each target component instance; Identify a function with a unique calling version as a directly referenced function, and identify a function without a unique calling version as an indirect referenced function, to obtain the directly referenced function and the indirect referenced function of each target component instance; The directly referenced functions and the indirect referenced functions of each target component instance are converted into bytecode files that can be directly executed in a Web environment.
6. The method according to claim 5, characterized in that The step of converting the directly referenced functions and the indirect referenced functions of each target component instance into a bytecode file that can be directly executed in a Web environment includes: Constructing a direct reference function call instruction corresponding to the direct reference function of each target component instance, and constructing an indirect reference function call instruction corresponding to the indirect reference function of each target component instance, to obtain a direct reference function call instruction set and an indirect reference function call instruction set of each target component instance; The direct reference function call instruction set and the indirect reference function call instruction set of each target component instance are rendered in hypertext markup language to obtain a bytecode file that can be directly executed in a Web environment.
7. The method according to claim 6, characterized in that The direct reference function call instruction corresponding to the direct reference function of each target component instance is constructed, including: Obtaining the executable file of the target Zion application; Putting all function identifiers of the directly referenced functions of each target component instance into the execution file in sequence, and obtaining the function offset of each directly referenced function in the execution file; According to the function offset, a direct reference function call instruction corresponding to the direct reference function of each target component instance is generated.
8. The method according to claim 5, characterized in that The obtaining of the instantiation source code of each target component instance includes: Load the pre-stored mapping relationship between component instances and data storage paths; Obtaining the component data storage path corresponding to each component instance in the mapping relationship, and obtaining the data storage path of each target component instance; Based on the data storage path of each target component instance, the instantiation source code corresponding to each target component instance is obtained.
9. A source code processing system for a low-code development platform, characterized in that: The system comprises: A file acquisition module, used to acquire the original Zion Schema file of the target Zion application, where the original Zion Schema file is edited by the user in a visual editor of the Zion product framework built into the low-code development platform; A file parsing module, used to parse the Zion Schema file, generate a functional component description of the target Zion application and a relationship table corresponding to each component, wherein the functional component description is used to define the properties and behaviors of each component in the target Zion application, and the relationship table is used to describe the hierarchical relationship and connection relationship of each component; A mapping table construction module is used to construct a functional component mapping table of the target Zion application according to the functional component description; wherein, The mapping table construction module is specifically used for: An initial mapping table is constructed using Object or Map in JavaScript, wherein the initial mapping table is used to store a mapping relationship between a component identifier and a corresponding component implementation, wherein the component implementation is an implementation code or reference of the component; Based on the functional component description, obtain the component identifier, type, data attributes and subcomponent reference list of each component from the original Zion Schema file; According to the type, data attributes and reference list of subcomponents, construct implementation code or reference of each component to obtain component implementation of each component; Establish a mapping relationship between the component identification of each component and the component implementation of each component to obtain a mapping entry of each component; Storing the mapping entry of each component in the initial mapping table to obtain a functional component mapping table of the target Zion application; A component rendering module, used to recursively render each component into a tree structure according to the functional component mapping table and the relationship table to obtain a component instance tree; The instance tree conversion module is used to convert the component instance tree into a bytecode file that can be directly executed in a Web environment as the runtime code corresponding to the target Zion application.
