CN110489124B - Source code execution method, source code execution device, storage medium and computer equipment - Google Patents

Source code execution method, source code execution device, storage medium and computer equipment Download PDF

Info

Publication number
CN110489124B
CN110489124B CN201910630506.3A CN201910630506A CN110489124B CN 110489124 B CN110489124 B CN 110489124B CN 201910630506 A CN201910630506 A CN 201910630506A CN 110489124 B CN110489124 B CN 110489124B
Authority
CN
China
Prior art keywords
source code
function
page
application program
preset
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
CN201910630506.3A
Other languages
Chinese (zh)
Other versions
CN110489124A (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.)
Zhejiang Koubei Network Technology Co Ltd
Original Assignee
Zhejiang Koubei Network Technology 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 Zhejiang Koubei Network Technology Co Ltd filed Critical Zhejiang Koubei Network Technology Co Ltd
Priority to CN201910630506.3A priority Critical patent/CN110489124B/en
Publication of CN110489124A publication Critical patent/CN110489124A/en
Application granted granted Critical
Publication of CN110489124B publication Critical patent/CN110489124B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/425Lexical analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a source code executing method, a device, a storage medium and computer equipment, which relate to the technical field of information and mainly aim at improving the update development efficiency of an application program, wherein the method comprises the following steps: loading source code updated by an application program; if the development language of the source code is different from that of the application program, analyzing the source code by using a preset analyzer to obtain the dependency relationship of each function in the source code; and carrying out reflection calling on each function by utilizing a native reflection mechanism corresponding to the source code and the dependency relationship to realize the execution of the source code. The method and the device are suitable for executing the source code.

Description

Source code execution method, source code execution device, storage medium and computer equipment
Technical Field
The present invention relates to the field of information technologies, and in particular, to a method and apparatus for executing source code, a storage medium, and a computer device.
Background
With the continuous development of information technology, in order to meet the work and living needs of people, the functions of application programs are more and more powerful, and the functions of the application programs are realized through source codes. In practical application, after the application program is released and online, the corresponding function of the application program is updated at any time, so that a new source code needs to be dynamically executed, and a section of code which is not coded before needs to be executed.
Currently, when an application program is updated and developed, it is generally necessary to develop new source code according to the development language of the application program. However, some developers may have low familiarity with the development language of the application program, and if a new source code is developed according to the development language of the application program, the development language of the application program needs to be learned and mastered, which results in higher update development cost of the application program and lower update development efficiency of the application program.
Disclosure of Invention
In view of this, the present invention provides a method, an apparatus, a storage medium, and a computer device for executing source code, which are mainly aimed at realizing direct loading and executing of source code different from the development language of an application program, so that a developer can update and develop the application program by using a development language familiar to himself without learning and mastering the development language of the application program again, and the update and development cost of the application program can be reduced, thereby improving the update and development efficiency of the application program. In addition, the new source code written in the original can be directly called and executed without being executed by the original running environment of the application program, so that the execution speed of the new source code can be improved.
According to a first aspect of the present invention, there is provided a source code execution method, comprising:
loading source code updated by an application program;
if the development language of the source code is different from that of the application program, analyzing the source code by using a preset analyzer to obtain the dependency relationship of each function in the source code;
and carrying out reflection calling on each function by utilizing a native reflection mechanism corresponding to the source code and the dependency relationship to realize the execution of the source code.
Optionally, the analyzing the source code by using a preset analyzer to obtain a dependency relationship of each function in the source code includes:
analyzing the source code by using a preset analyzer to obtain an abstract syntax tree corresponding to the source code, wherein the syntax abstract tree is used for storing the dependency relationship;
the performing reflection calling on the functions by using the native reflection mechanism corresponding to the source code and the dependency relationship to implement the execution of the source code includes:
and carrying out reflection calling on each function in the abstract syntax tree by using a native reflection mechanism corresponding to the source code so as to realize the execution of the source code.
Optionally, the performing reflection calling on each function in the abstract syntax tree by using a native reflection mechanism corresponding to the source code to implement executing the source code includes:
if the source code is an OC source code, carrying out reflection processing on the class in the abstract syntax tree by utilizing a preset OC reflection mechanism to obtain a class object;
and carrying out reflection calling on each function corresponding to the class object to realize the execution of the source code.
Optionally, the preset parser includes a preset word segmentation unit and a preset context rule, and the parsing the source code by using the preset parser to obtain a dependency relationship of each function in the source code includes:
performing lexical analysis on the source codes by using the preset word segmentation device;
and carrying out grammar analysis on each obtained word by utilizing the preset context rule to obtain the dependency relationship of each function in the source code.
Further, after the loading the source code of the application program update function, the method further includes:
and if the development language of the source code is the same as that of the application program, directly executing the source code.
Optionally, the loading the source code of the application program update includes:
receiving a page loading request updated by an application program, wherein the page loading request carries an updated page identifier;
inquiring and loading corresponding source codes according to the page identification;
the performing reflection calling on the functions by using the native reflection mechanism corresponding to the source code and the dependency relationship to implement the execution of the source code includes:
and carrying out reflection calling on each function by utilizing a native reflection mechanism corresponding to the source code and the dependency relationship so as to realize the execution of the source code and output an updated page.
According to a second aspect of the present invention, there is provided a source code execution apparatus comprising:
loading source code updated by an application program;
if the development language of the source code is different from that of the application program, analyzing the source code by using a preset analyzer to obtain the dependency relationship of each function in the source code;
and carrying out reflection calling on each function by utilizing a native reflection mechanism corresponding to the source code and the dependency relationship to realize the execution of the source code.
Optionally, the parsing unit is specifically configured to parse the source code by using a preset parser to obtain an abstract syntax tree corresponding to the source code, where the abstract syntax tree is used to store the dependency relationship;
the executing unit is specifically configured to perform reflection calling on each function in the abstract syntax tree by using a native reflection mechanism corresponding to the source code, so as to implement executing the source code.
Optionally, the executing unit is specifically configured to, if the source code is an OC source code, perform reflection processing on a class in the abstract syntax tree by using a preset OC reflection mechanism, so as to obtain a class object; and performing reflection calling on each function corresponding to the class object to realize the execution of the source code.
Optionally, the parsing unit is specifically configured to perform lexical analysis on the source code by using the preset word segmentation device when the preset parser includes the preset word segmentation device and a preset context rule; and analyzing the grammar of each word by utilizing the preset context rule to obtain the dependency relationship of each function in the source code.
Further, the execution unit is further configured to directly execute the source code if the development language of the source code is the same as the development language of the application program.
Optionally, the loading unit is specifically configured to receive a page loading request updated by an application program, where the page loading request carries an updated page identifier; inquiring and loading corresponding source codes according to the page identification;
the execution unit is specifically configured to perform reflection call on the functions by using a native reflection mechanism corresponding to the source code and the dependency relationship, so as to implement execution of the source code, and output an updated page.
According to a third aspect of the present invention, there is provided a storage medium having stored therein at least one executable instruction for causing a processor to perform the steps of:
loading source code updated by an application program;
if the development language of the source code is different from that of the application program, analyzing the source code by using a preset analyzer to obtain the dependency relationship of each function in the source code;
and carrying out reflection calling on each function by utilizing a native reflection mechanism corresponding to the source code and the dependency relationship to realize the execution of the source code.
According to a fourth aspect of the present invention there is provided a computer device comprising a processor, a memory, a communications interface and a communications bus, said processor, said memory and said communications interface completing communications with each other via said communications bus, said memory for storing at least one executable instruction, said executable instruction causing said processor to perform the steps of:
loading source code updated by an application program;
if the development language of the source code is different from that of the application program, analyzing the source code by using a preset analyzer to obtain the dependency relationship of each function in the source code;
and carrying out reflection calling on each function by utilizing a native reflection mechanism corresponding to the source code and the dependency relationship to realize the execution of the source code.
Compared with the existing method for developing new source codes according to the development language of application programs, the method and the device for executing the source codes can load the source codes updated by the application programs, and can analyze the source codes by utilizing a preset analyzer when the development language of the source codes is different from that of the application programs so as to obtain the dependency relationship of each function in the source codes. Meanwhile, the original reflection mechanism corresponding to the source code and the dependency relationship can be utilized to carry out reflection call on each function so as to realize execution of the source code, so that the source code which is different from the development language of the application program can be directly loaded and executed, a developer can update and develop the application program by using the familiar development language without learning and mastering the development language of the application program again, the update and development cost of the application program can be reduced, and the update and development efficiency of the application program can be improved. In addition, the new source code written in the original can be directly called and executed without being executed by the original running environment of the application program, so that the execution speed of the new source code can be improved.
The foregoing description is only an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present invention more readily apparent.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
FIG. 1 is a schematic flow chart of a source code execution method according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating another source code execution method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a source code executing device according to an embodiment of the present invention;
fig. 4 shows a schematic physical structure of a computer device according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
As described in the background, currently, when an application program is updated and developed, it is generally necessary to develop a new source code according to the development language of the application program. However, some developers may have low familiarity with the development language of the application program, and if a new source code is developed according to the development language of the application program, the development language of the application program needs to be learned and mastered, which results in higher update development cost of the application program and lower update development efficiency of the application program.
In order to solve the above technical problems, an embodiment of the present invention provides a method for executing source code, as shown in fig. 1, where the method includes:
101. the source code for the application update is loaded.
The initial development language of the application program can be a Java development language and a C, C ++ development language, and the running environment of the initial developed source code can be a node. The updated source code may be the source code corresponding to the new service carried by the application. The development language of the updated source code can be the same as or different from the initial development language of the application program, and the development language of the updated source code can be a javascript development language, a C, C ++ development language or an Objective-C (OC) development language. The updated source code may specifically be loaded when a page loading request corresponding to a new function is received, and the execution subject of the embodiment of the present invention may be a server. The server may store source code initially published by the application and source code subsequently updated.
102. If the development language of the source code is different from that of the application program, analyzing the source code by using a preset analyzer to obtain the dependency relationship of each function in the source code.
The preset parser can obtain the dependency relationship of each function in the source code by performing lexical and grammatical parsing on the source code. The dependency relationship can be a reference relationship between functions or an execution sequence relationship between functions, and when the dependency relationship exists between the functions and other functions, the execution result of the function needs to be dependent on the execution result of the other functions. The dependency relationship can be represented by an abstract syntax tree, so that a preset parser can be utilized to parse the source code to obtain the abstract syntax tree corresponding to the source code, then the source code is executed according to the abstract syntax tree, and page objects required by operation are created and sent to a client for use by a user.
103. And carrying out reflection calling on each function by utilizing a native reflection mechanism corresponding to the source code and the dependency relationship so as to realize the execution of the source code.
For the embodiment of the present invention, if the development language corresponding to the source code is an Objective-C development language, the native reflection mechanism corresponding to the source code may be an Objective-C reflection mechanism. If the development language corresponding to the source code is a Java development language, the native reflection mechanism corresponding to the source code may be a Java reflection, or if the development language corresponding to the source code is a C# development language, the native reflection mechanism corresponding to the source code may be a C# reflection mechanism. By utilizing the original reflection mechanism corresponding to the source code, each function in the dependency relationship can be directly subjected to reflection call, namely each statement or instruction can be recursively and downwardly executed, the execution can be realized while analysis, and the binary file compiled by the source code is not required to be executed again in advance, so that the execution speed of the source code can be improved.
Compared with the prior art that a new source code needs to be developed according to the development language of an application program, the source code executing method provided by the embodiment of the invention can load the source code updated by the application program, and when the development language of the source code is different from the development language of the application program, the source code can be analyzed by using a preset analyzer, so that the dependency relationship of each function in the source code is obtained. Meanwhile, the original reflection mechanism corresponding to the source code and the dependency relationship can be utilized to carry out reflection call on each function so as to realize execution of the source code, so that the source code which is different from the development language of the application program can be directly loaded and executed, a developer can update and develop the application program by using the familiar development language without learning and mastering the development language of the application program again, the update and development cost of the application program can be reduced, and the update and development efficiency of the application program can be improved. In addition, the new source code written in the original can be directly called and executed without being executed by the original running environment of the application program, so that the execution speed of the new source code can be improved.
Further, in order to better illustrate the process of the source code execution method, as a refinement and extension to the above embodiment, several alternative embodiments are provided in the present embodiment, but not limited thereto, and specifically shown as follows:
in an optional embodiment of the present invention, the step of analyzing the source code by using a preset analyzer to obtain the dependency relationship of each function in the source code may specifically include: and analyzing the source code by using a preset analyzer to obtain an abstract syntax tree corresponding to the source code, wherein the syntax abstract tree is used for storing the dependency relationship. Correspondingly, the step 103 may specifically include: and carrying out reflection calling on each function in the abstract syntax tree by using a native reflection mechanism corresponding to the source code so as to realize the execution of the source code.
In another optional embodiment of the present invention, the performing a reflection call on each function in the abstract syntax tree by using a native reflection mechanism corresponding to the source code to implement executing the source code includes: if the source code is an OC source code, carrying out reflection processing on the class in the abstract syntax tree by utilizing a preset OC reflection mechanism to obtain a class object; and carrying out reflection calling on each function corresponding to the class object to realize the execution of the source code. For example, if a service page is to be newly added in an application program, for the application program developed by using the javascript development language, a service developer does not need to use the javascript development language to develop and realize loading of source codes of the service page, and only needs to use the OC development language familiar to the service developer, when the service page is actually loaded, an entry function startapp (NSString) app id of the service page can be queried, and then a page creation class createPage is reflected according to an OC reflection mechanism to obtain a createPage class object, and then a function of the class object is called: createbutton (); createinputbox () or the like creates individual page elements, thereby realizing loading of the business page, as shown in fig. 2.
In a specific application scenario, the specific process of analyzing the source code by using a preset analyzer to obtain the dependency relationship of each function in the source code may include: if the preset parser comprises a preset word segmentation device and a preset context rule, performing lexical analysis on the source code by using the preset word segmentation device; and analyzing the grammar of each word by utilizing the preset context rule to obtain the dependency relationship of each function in the source code. Specifically, after lexical analysis and grammar analysis of the source code, an abstract grammar tree corresponding to the source code can be obtained. The preset word segmentation device can segment the source code in a mode of matching the source code with a known word stock. The preset context rule may be a rule for determining the meaning represented by a word according to the front word and the rear word of the word.
The method further comprises the steps of: and if the development language of the source code is the same as that of the application program, directly executing the source code.
In yet another alternative embodiment of the present invention, the loading the source code of the application program update may specifically include: receiving a page loading request updated by an application program, wherein the page loading request carries an updated page identifier; and inquiring and loading the corresponding source codes according to the page identification. Correspondingly, the specific steps of performing the source code by using the native reflection mechanism and the dependency relationship corresponding to the source code to perform the reflection call on the functions may include: and carrying out reflection calling on each function by utilizing a native reflection mechanism corresponding to the source code and the dependency relationship so as to realize the execution of the source code and output an updated page.
Further, as a specific implementation of fig. 1, an embodiment of the present invention provides a source code executing apparatus, as shown in fig. 3, where the apparatus includes: a loading unit 21, a parsing unit 22 and an executing unit 22.
The loading unit 21 may be configured to load source code of an application update. The loading unit 21 is the main functional module of the device for loading the source code of the application program update.
The parsing unit 22 may be configured to parse the source code by using a preset parser if the development language of the source code is different from the development language of the application program, so as to obtain the dependency relationship of each function in the source code. The parsing unit 22 is a main functional module, which is also a core module, for parsing the source code by using a preset parser to obtain the dependency relationship of each function in the source code.
The executing unit 23 may be configured to perform a reflection call on the respective functions by using a native reflection mechanism corresponding to the source code and the dependency relationship, so as to implement executing the source code. The execution unit 23 is a main functional module for executing the source code by performing reflection call on the functions by using a native reflection mechanism corresponding to the source code and the dependency relationship in the device.
The parsing unit 22 may specifically be configured to parse the source code by using a preset parser to obtain an abstract syntax tree corresponding to the source code, where the abstract syntax tree is used to store the dependency relationship.
The executing unit 23 may specifically be configured to perform a reflection call on each function in the abstract syntax tree by using a native reflection mechanism corresponding to the source code, so as to implement executing the source code.
The executing unit 23 may be specifically configured to, if the source code is an OC source code, perform reflection processing on a class in the abstract syntax tree by using a preset OC reflection mechanism to obtain a class object; and performing reflection calling on each function corresponding to the class object to realize the execution of the source code.
The parsing unit 22 may be specifically configured to perform lexical analysis on the source code using a preset word segmentation device when the preset parser includes the preset word segmentation device and a preset context rule; and analyzing the grammar of each word by utilizing the preset context rule to obtain the dependency relationship of each function in the source code.
The execution unit 23 may be further configured to directly execute the source code if the development language of the source code is the same as the development language of the application program.
In a specific application scenario, the loading unit 21 may specifically be configured to receive a page loading request updated by an application program, where the page loading request carries an updated page identifier; inquiring and loading corresponding source codes according to the page identification;
the executing unit 23 may specifically be configured to perform reflection calling on the functions by using a native reflection mechanism corresponding to the source code and the dependency relationship, so as to implement executing the source code and output an updated page.
It should be noted that, other corresponding descriptions of each functional module related to the source code execution apparatus provided by the embodiment of the present invention may refer to corresponding descriptions of the method shown in fig. 1, which are not repeated herein.
Based on the above method as shown in fig. 1, correspondingly, an embodiment of the present invention further provides a storage medium, where at least one executable instruction is stored in the storage medium, and the execution instruction causes a processor to execute the following steps: loading source code updated by an application program; if the development language of the source code is different from that of the application program, analyzing the source code by using a preset analyzer to obtain the dependency relationship of each function in the source code; and carrying out reflection calling on each function by utilizing a native reflection mechanism corresponding to the source code and the dependency relationship so as to realize the execution of the source code.
Based on the above embodiments of the method shown in fig. 1 and the apparatus shown in fig. 3, the embodiment of the present invention further provides a computer device, as shown in fig. 4, including a processor (processor) 31, a communication interface (Communications Interface) 32, a memory (memory) 33, and a communication bus 34. Wherein: the processor 31, the communication interface 32, and the memory 33 perform communication with each other via the communication bus 34. A communication interface 34 for communicating with network elements of other devices, such as clients or other servers. The processor 31 is configured to execute a program, and may specifically perform relevant steps in the embodiment of the method for converting data described above. In particular, the program may include program code including computer-operating instructions. The processor 31 may be a central processing unit CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement embodiments of the present invention.
The one or more processors included in the terminal may be the same type of processor, such as one or more CPUs; but may also be different types of processors such as one or more CPUs and one or more ASICs. And a memory 33 for storing a program. The memory 33 may comprise a high-speed RAM memory or may further comprise a non-volatile memory (non-volatile memory), such as at least one disk memory. The program may be specifically for causing the processor 31 to: loading source code updated by an application program; if the development language of the source code is different from that of the application program, analyzing the source code by using a preset analyzer to obtain the dependency relationship of each function in the source code; and carrying out reflection calling on each function by utilizing a native reflection mechanism corresponding to the source code and the dependency relationship so as to realize the execution of the source code.
According to the technical scheme, the source code updated by the application program can be loaded, and when the development language of the source code is different from that of the application program, the source code can be analyzed by using a preset analyzer, so that the dependency relationship of each function in the source code is obtained. Meanwhile, the original reflection mechanism corresponding to the source code and the dependency relationship can be utilized to carry out reflection call on each function so as to realize execution of the source code, so that the source code which is different from the development language of the application program can be directly loaded and executed, a developer can update and develop the application program by using the familiar development language without learning and mastering the development language of the application program again, the update and development cost of the application program can be reduced, and the update and development efficiency of the application program can be improved. In addition, the new source code written in the original can be directly called and executed without being executed by the original running environment of the application program, so that the execution speed of the new source code can be improved.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
It will be appreciated that the relevant features of the methods and apparatus described above may be referenced to one another. In addition, the "first", "second", and the like in the above embodiments are for distinguishing the embodiments, and do not represent the merits and merits of the embodiments.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with the teachings herein. The required structure for a construction of such a system is apparent from the description above. In addition, the present invention is not directed to any particular programming language. It will be appreciated that the teachings of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component and, furthermore, they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
Various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that some or all of the functions of some or all of the components in a source code execution apparatus according to an embodiment of the present invention may be implemented in practice using a microprocessor or Digital Signal Processor (DSP). The present invention can also be implemented as an apparatus or device program (e.g., a computer program and a computer program product) for performing a portion or all of the methods described herein. Such a program embodying the present invention may be stored on a computer readable medium, or may have the form of one or more signals. Such signals may be downloaded from an internet website, provided on a carrier signal, or provided in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names.

Claims (10)

1. A method of executing source code, comprising:
loading source code updated by an application program;
if the development language of the source code is different from that of the application program, analyzing the source code by using a preset analyzer to obtain the dependency relationship of each function in the source code, and generating an abstract syntax tree representing the dependency relationship, wherein the dependency relationship comprises a reference relationship among each function or an execution sequence relationship among each function;
carrying out recursion descent strip-by-strip reflection calling on each function of the abstract syntax tree by using a native reflection mechanism corresponding to the source code, and outputting an updated page;
the method for performing recursive descent strip-by-strip reflection calling on each function of the abstract syntax tree by using the original reflection mechanism of the source code, and outputting an updated page comprises the following steps:
querying the abstract syntax tree, determining a page entry function, and creating a class object for the page entry function;
determining each function on which the class object depends according to the abstract syntax tree, and performing recursively descending and piece-by-piece reflection calling on each function to create page elements;
the updated page is output based on the page element.
2. The method according to claim 1, wherein the preset parser includes a preset word segmentation unit and a preset context rule, and the parsing the source code by the preset parser to obtain the dependency relationship of each function in the source code includes:
performing lexical analysis on the source codes by using the preset word segmentation device;
and carrying out grammar analysis on each obtained word by utilizing the preset context rule to obtain the dependency relationship of each function in the source code.
3. The method of claim 1, wherein after loading the source code of the application update function, the method further comprises:
and if the development language of the source code is the same as that of the application program, directly executing the source code.
4. The method of claim 1, wherein loading source code for an application update comprises:
receiving a page loading request updated by an application program, wherein the page loading request carries an updated page identifier;
and inquiring and loading the corresponding source codes according to the page identification.
5. A source code execution apparatus, comprising:
the loading unit is used for loading the source code updated by the application program;
the analyzing unit is used for analyzing the source code by using a preset analyzer if the development language of the source code is different from that of the application program, so as to obtain the dependency relationship of each function in the source code, and generating an abstract syntax tree for representing the dependency relationship, wherein the dependency relationship comprises a reference relationship among each function or an execution sequence relationship among each function;
the execution unit is used for carrying out recursion descent strip-by-strip reflection calling on each function of the abstract syntax tree by utilizing a native reflection mechanism corresponding to the source code, and outputting an updated page;
wherein, the execution unit is specifically configured to: querying the abstract syntax tree, determining a page entry function, and creating a class object for the page entry function; and determining each function on which the class object depends according to the abstract syntax tree, performing recursively descending piece-by-piece reflection calling on each function to create a page element, and outputting an updated page based on the page element.
6. The apparatus of claim 5, wherein the device comprises a plurality of sensors,
the parsing unit is specifically configured to perform lexical analysis on the source code by using a preset word segmentation device when the preset parser includes the preset word segmentation device and a preset context rule; and analyzing the grammar of each word by utilizing the preset context rule to obtain the dependency relationship of each function in the source code.
7. The apparatus of claim 5, wherein the device comprises a plurality of sensors,
the execution unit is further configured to directly execute the source code if the development language of the source code is the same as the development language of the application program.
8. The apparatus of claim 5, wherein the device comprises a plurality of sensors,
the loading unit is specifically configured to receive a page loading request updated by an application program, where the page loading request carries an updated page identifier; and inquiring and loading the corresponding source codes according to the page identification.
9. A storage medium having stored thereon a computer program having stored therein at least one executable instruction for causing a processor to perform operations corresponding to the source code execution method of any of claims 1-4.
10. A computer device comprising a processor, a memory, a communication interface and a communication bus, the processor, the memory and the communication interface being in communication with each other via the communication bus, the memory being for storing at least one executable instruction that causes the processor to perform the source code of any of claims 1-4 to perform corresponding operations.
CN201910630506.3A 2019-07-12 2019-07-12 Source code execution method, source code execution device, storage medium and computer equipment Active CN110489124B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910630506.3A CN110489124B (en) 2019-07-12 2019-07-12 Source code execution method, source code execution device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910630506.3A CN110489124B (en) 2019-07-12 2019-07-12 Source code execution method, source code execution device, storage medium and computer equipment

Publications (2)

Publication Number Publication Date
CN110489124A CN110489124A (en) 2019-11-22
CN110489124B true CN110489124B (en) 2023-06-13

Family

ID=68546903

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910630506.3A Active CN110489124B (en) 2019-07-12 2019-07-12 Source code execution method, source code execution device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN110489124B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111061468B (en) * 2019-12-20 2023-10-10 北京爱奇艺科技有限公司 Mapping method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109032606A (en) * 2018-07-10 2018-12-18 北京小米移动软件有限公司 The process of compilation method, apparatus and terminal of native applications program
CN109388403A (en) * 2018-09-26 2019-02-26 广州视源电子科技股份有限公司 Rely on method for implanting, device, equipment and storage medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103793652A (en) * 2012-10-29 2014-05-14 广东电网公司信息中心 Application system code safety scanning device based on static analysis
CN104111855A (en) * 2014-07-29 2014-10-22 广东能龙教育股份有限公司 Method for dynamic update of iOS (Iphone Operation System) client based on Lua
CN107943493A (en) * 2016-10-12 2018-04-20 北京京东尚科信息技术有限公司 A kind of method and apparatus that problem in the App that reached the standard grade is repaired based on iOS system silence
CN109656773B (en) * 2017-10-12 2023-03-10 卓望数码技术(深圳)有限公司 Processing framework based on IOS application abnormal crash
CN108628635B (en) * 2018-05-07 2021-12-14 广州视源电子科技股份有限公司 Method, device, equipment and storage medium for acquiring parameter name and local variable name
CN109525584B (en) * 2018-11-26 2020-12-04 竞技世界(北京)网络技术有限公司 Method for constructing mobile end cross-platform multi-type application container
CN109976793B (en) * 2019-03-15 2022-05-10 北京字节跳动网络技术有限公司 Application program running method, device, equipment and medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109032606A (en) * 2018-07-10 2018-12-18 北京小米移动软件有限公司 The process of compilation method, apparatus and terminal of native applications program
CN109388403A (en) * 2018-09-26 2019-02-26 广州视源电子科技股份有限公司 Rely on method for implanting, device, equipment and storage medium

Also Published As

Publication number Publication date
CN110489124A (en) 2019-11-22

Similar Documents

Publication Publication Date Title
CN109976761B (en) Software development kit generation method and device and terminal equipment
CN106547527B (en) JavaScript file construction method and device
US8626786B2 (en) Dynamic language checking
CN110069259B (en) ID L file-based parsing method and device, electronic equipment and storage medium
CN111221842A (en) Big data processing system and method
US20190146764A1 (en) Using comments of a program to provide optimizations
CN109542455B (en) Contract execution method, contract reduction method, device, and storage medium
CN105204917B (en) The method and device of loading configuration file in application program launching
CN111427583A (en) Component compiling method and device, electronic equipment and computer readable storage medium
CN116860949B (en) Question-answering processing method, device, system, computing equipment and computer storage medium
CN111309751A (en) Big data processing method and device
CN110990001A (en) IVR (Interactive Voice response) process execution method and device
CN114327477A (en) Intelligent contract execution method and device, electronic device and storage medium
CN112558984A (en) Code compiling method and device, electronic equipment and server
CN108920179A (en) Java reflects implementation method, device and system
CN110489124B (en) Source code execution method, source code execution device, storage medium and computer equipment
CN111580821B (en) Script binding method and device, electronic equipment and computer readable storage medium
CN117008920A (en) Engine system, request processing method and device, computer equipment and storage medium
CN111880801A (en) Application program dynamic method and device and electronic equipment
CN114911541B (en) Processing method and device of configuration information, electronic equipment and storage medium
CN116431127A (en) Low code development method, system, equipment and readable storage medium
CN111221841A (en) Real-time processing method and device based on big data
CN113141407B (en) Page resource loading method and device and electronic equipment
CN112650502A (en) Batch processing task processing method and device, computer equipment and storage medium
CN111221843A (en) Big data processing method and device

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