Coexistence and switching method of interpreted language and compiled language

Through the coexistence and switching method of interpreted languages ​​and compiled languages, the problem of requiring system recompilation when modifying compiled languages ​​is solved, the efficiency of software development and cross-team collaboration is improved, and the flexibility and rapid iteration of development languages ​​are achieved.

CN120803461APending Publication Date: 2025-10-17CARERAY DIGITAL MEDICAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511177634.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-21
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

In software development with high reliability requirements, modifications to intended functions in compiled languages ​​require recompilation of the entire system, resulting in low iteration efficiency and increased costs, especially when collaborating across departments.

Method used

Provides a coexistence and switching method for interpreted languages ​​and compiled languages. By configuring execution methods and parameters, using strategy interfaces and factory patterns, it achieves development iteration of interpreted languages ​​and efficient execution of compiled languages.

Benefits of technology

It improves the efficiency of software development, reduces the cost of cross-team collaboration, and achieves flexibility in development language and rapid iteration in the testing phase.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120803461A_ABST
    Figure CN120803461A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of software development, in particular to a coexistence and switching method of an interpreted language and a compiled language. The coexistence and switching method comprises the steps that a first execution method and a second execution method are configured for a preset function, the first execution method executes codes which correspond to the preset function and are written by a compilation type language, and the second execution method calls and executes codes which correspond to the preset function and are written by an interpretation type language; based on the requirement of the execution method of the preset function, configuring parameters corresponding to the execution method in the configuration item; and in response to the received call request of the predetermined function, the upstream software selects the first execution method or the second execution method for execution according to the parameters of the execution method configured in the configuration item. According to the coexistence and switching method of the interpreted language and the compiled language, coexistence of different development languages is achieved, and the development efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of software development, in particular to a coexistence and switching method of an interpreted language and a compiled language. BACKGROUND

[0002] In the field of software development, especially in application scenarios such as medical devices and industrial control with high reliability requirements, in order to meet the real-time requirements, some predetermined functions in software development are usually implemented by using a compiled language.

[0003] However, each modification of the predetermined function implemented by using the compiled language during development needs to recompile the entire system, resulting in low development iteration efficiency of the predetermined function, increasing the time cost, and when there is cross-department cooperation, the time cost is further increased. SUMMARY

[0004] In order to solve the problems in the prior art, the purpose of the present application is to provide a coexistence and switching method of an interpreted language and a compiled language, and improve the efficiency of software development.

[0005] To achieve the above purpose, the present application provides a coexistence and switching method of an interpreted language and a compiled language, comprising: configuring a first execution method and a second execution method for the predetermined function, the first execution method executing the code corresponding to the predetermined function written by the compiled language, and the second execution method calling and executing the code corresponding to the predetermined function written by the interpreted language; based on the requirement of the execution method of the predetermined function, configuring the parameters of the corresponding execution method in the configuration item; in response to receiving the calling request of the predetermined function, the upstream software selects the first execution method or the second execution method for execution according to the parameters of the execution method configured in the configuration item.

[0006] Further, the predetermined function is configured to include a strategy interface, the strategy interface includes a first strategy class and a second strategy class, the first strategy class is configured to execute the first execution method, and the second strategy class is configured to execute the second execution method.

[0007] Further, the predetermined function is configured to include a factory interface, the factory interface defines a creation method of a product executing the predetermined function, and the factory interface includes a first factory class and a second factory class; the first factory class is configured to create an instance of a first product class to implement a product interface of the predetermined function by using the first execution method; and the second factory class is configured to create an instance of a second product class to implement the product interface of the predetermined function by using the second execution method.

[0008] Furthermore, the predetermined function is encapsulated as a library file.

[0009] Furthermore, the method further comprises: In the configuration item, modify the parameters of the execution method to the second execution method, and modify the interpreted language script until the execution result meets the expectations.

[0010] Furthermore, the interpreted language includes but is not limited to Python and Matlab, and the compiled language includes any one of C++ and Java.

[0011] Furthermore, the second execution method calls and executes the code written in the interpreted language corresponding to the predetermined function through a third-party library or a cross-language bridging unit.

[0012] To achieve the above objectives, the present application further provides an electronic device, comprising: processor; a memory having stored thereon one or more computer program instructions executed on the processor; When the processor runs the computer program instructions, the above-mentioned coexistence and switching method of the interpreted language and the compiled language is executed.

[0013] To achieve the above objectives, the present application also provides a computer-readable storage medium on which computer instructions are stored. When the computer instructions are executed by a processor, the steps of the coexistence and switching method of interpreted language and compiled language as described above are executed.

[0014] The coexistence and switching method of interpreted languages ​​and compiled languages ​​provided in this application realizes the coexistence of different development languages, facilitates developers to select the corresponding language for development according to their needs, and improves the flexibility of development language selection.

[0015] The coexistence and switching method of interpreted language and compiled language provided in this application uses the second execution method corresponding to the interpreted language to implement the predetermined function during the test development stage, and then development iterations can be performed by modifying the interpreted language script, greatly improving the efficiency of test development.

[0016] The coexistence and switching method of interpreted languages ​​and compiled languages ​​provided in this application completely decouples the main program and algorithm implementation through a standardized dynamic library interface, reducing the cost of cross-team collaboration.

[0017] Other features and advantages of the present application will be set forth in the following description, and in part will be apparent from the description, or may be learned by practicing the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The accompanying drawings are used to provide a further understanding of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. In the accompanying drawings: Figure 1 This is a flowchart of the coexistence and switching method of interpreted language and compiled language in Example 1 of the present application. DETAILED DESCRIPTION

[0019] The following describes embodiments of the present application in more detail with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are for illustrative purposes only and are not intended to limit the scope of protection of the present application.

[0020] It should be understood that the various steps described in the method embodiments of the present application can be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this respect.

[0021] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Other terms are defined in the following description.

[0022] It should be noted that the modifications of "one" and "plurality" mentioned in this application are illustrative rather than restrictive. Those skilled in the art will understand that unless the context clearly indicates otherwise, they should be understood as "one or more." "Plurality" should be understood as two or more.

[0023] Explanation of terms: Intelligent Collimator Positioning System: An innovative technology based on controllable magnetic field spatial positioning, designed to solve the precise spatial registration problem of X-ray collimator and flat panel detector (FPD) in medical imaging equipment such as DR digital radiography and mobile applications. The core breakthrough lies in abandoning traditional optical or mechanical positioning methods, and instead using electromagnetic coupling principles to achieve non-contact dynamic positioning. When the system is working, the controllable magnetic field source array (usually composed of micro electromagnetic coils) built-in the collimator end generates a specific modulated three-dimensional gradient magnetic field, and the high-sensitivity magnetic sensor array (such as Hall sensor or magnetic resistance sensor) embedded in the flat panel detector captures the magnetic field signal in real time. By solving the spatial distribution of magnetic field strength and direction, using positioning algorithm to accurately calculate the relative position between the two, finally forming a closed-loop positioning control with millimeter-level precision.

[0024] Static Library: A static library is a pre-compiled code collection that is fully integrated into the final executable file during the linking phase of software construction. It is essentially an archive of object files, usually with a.a extension on Unix-like systems (such as Linux, macOS) created by the ar tool, and.lib extension on Windows systems.

[0025] Dynamic Library: A dynamic library (also known as a shared library) is a code library that is loaded into memory only at runtime. Unlike static libraries, it is not directly embedded into the final executable file at compile time, but is dynamically linked by the operating system during program startup or runtime. The core advantage of dynamic libraries is resource sharing: multiple programs can simultaneously call the same library code in physical memory, significantly reducing system resource usage. In addition, updating a dynamic library does not require recompiling the main program (only replacing the library file), greatly improving the flexibility of software maintenance. Typical examples include Windows.dll files and Linux.so files.

[0026] In the technical solutions of this application, developers can update dynamic libraries or static libraries (to optimize C++ positioning algorithms) individually without the need to recompile the entire system. Dynamic libraries or static libraries expose functions through standardized interfaces for the main program to call.

[0027] Strategy Pattern: The Strategy pattern is a behavioral design pattern that encapsulates an algorithm or business rule into a separate class, making it interchangeable. This pattern defines a uniform strategy interface, lets different algorithms implement this interface, and dynamically selects a specific strategy to execute through a Context class. For example, in a payment system, different payment methods such as Alipay and WeChat Pay can be encapsulated as implementation classes of the PaymentStrategy interface. The payment process only needs to call the executePayment() method of the Context class, without worrying about the internal payment logic.

[0028] Factory Pattern: The Factory pattern is a creational design pattern that abstracts the object creation process, decoupling the creation logic from the usage logic. It defines a uniform interface for creating objects, and the specific class to instantiate is determined by the child class or concrete factory. This allows the system to extend new object types without modifying existing code, perfectly adhering to the Open / Closed Principle. The essence of the Factory pattern is to encapsulate changes, isolating the object creation process, so that the client only depends on the abstract interface rather than the concrete implementation, thereby improving code flexibility, maintainability, and testability.

[0029] Compiled Language: Compiled languages (such as C, C++, Golang) require the program to be converted into native machine code for the target machine by the compiler before running. The compilation process includes lexical analysis, syntax optimization, linking, and other steps to generate binary files (such as.exe for Windows) that can be directly executed by the CPU. The biggest advantage is high execution efficiency (no runtime translation overhead) and deep optimization of hardware resource utilization.

[0030] Interpreted Language: Interpreted languages (such as Python, JavaScript, Ruby) do not need to be pre-compiled, but are translated and executed line by line by the interpreter at runtime. The program is distributed in source code form (or generates intermediate bytecode), which is dynamically translated into machine instructions by the interpreter. The core advantage is cross-platform (the same code can run on any environment with an interpreter) and development efficiency (immediate effect after modification, no need to compile).

[0031] In the following, embodiments of the present application will be described in detail with reference to the accompanying drawings.

[0032] Example 1 One embodiment of the present application provides a coexistence and switching method of an interpreted language and a compiled language, which is applied to positioning calculation of an intelligent light beam positioning system, Figure 1 FIG. 1 is a flowchart of the coexistence and switching method of the interpreted language and the compiled language of Embodiment 1 of the present application. The following will refer to Figure 1 The coexistence and switching method of the interpreted language and the compiled language of the present application will be described in detail, including: Step S101: configuring a first execution method and a second execution method for a predetermined function, the first execution method executing code written by a compiled language corresponding to the predetermined function, and the second execution method calling and executing code written by an interpreted language corresponding to the predetermined function; In the present embodiment, the configuration of the predetermined function is implemented using a strategy mode, and the predetermined function is configured to include a strategy interface, the strategy interface including a first strategy class and a second strategy class, the first strategy class being configured to execute the first execution method, and the second strategy class being configured to execute the second execution method.

[0033] In the present embodiment, the code written by the interpreted language and the code written by the compiled language are both used for positioning calculation, and the contents of the two can be the same or different in terms of the algorithm of the positioning calculation, for example, the function code written by the interpreted language can use a first generation positioning algorithm, and the function code written by the compiled language can use the first generation positioning algorithm or a second generation positioning algorithm.

[0034] In some other embodiments, the strategy classes included in the strategy interface can also be configured respectively to implement switching of different positioning algorithms and comparison of algorithm performance, for example, the strategy classes corresponding to the interpreted language are configured with four, and the four strategy classes execute four execution methods respectively, each execution method corresponding to different code written by the interpreted language for positioning calculation, and the switching of different strategies and execution methods is completed by a configuration item according to needs; for example, the strategy classes corresponding to the compiled language are configured with two, one being a V1 version and the other being a latest version, and the configuration item defaults to the latest version as the strategy object, and when the V1 version is needed, the V1 version can also be directly switched by the configuration item.

[0035] In some other embodiments, multiple strategy classes of the interpreted language can also be configured, and each strategy class of the interpreted language corresponds to a different interpreted language, for example, two strategy classes of the interpreted language are configured, one using Python as the interpreted language and the other using Matlab as the interpreted language.

[0036] In the present embodiment, Python is used as the interpreted language and C++ is used as the compiled language. In the present embodiment, Python is used as the interpreted language and C++ is used as the compiled language.

[0037] In the embodiment, the whole predetermined function is packaged as a dynamic library.

[0038] In some other embodiments, the whole predetermined function can also be packaged as a library file such as a static library, which can be loaded and used by the upstream software flexibly according to actual deployment.

[0039] In the embodiment, the dynamic library file is a.so format dynamic library file adapted to the Linux operating system, which will be loaded into the memory by the operating system for execution when the upstream software runs.

[0040] In some other embodiments, when the operating system is a Windows operating system, the dynamic library file is a.dll format file.

[0041] Step S102: based on the requirement of the execution method of the predetermined function, configure the parameters of the corresponding execution method in the configuration item; In the embodiment, the strategy used when executing the predetermined function will be configured in the configuration item according to actual requirements. When receiving the calling request of the predetermined function, the corresponding strategy class is instantiated to execute the corresponding method.

[0042] For example, in the test phase, the second execution method using the corresponding interpreted language is configured in the configuration item to perform positioning calculation; and then the development iteration of the positioning algorithm can be performed by modifying the interpreted language script, thereby improving the research and development efficiency of the positioning algorithm.

[0043] When the test execution result meets the expectation, the interpreted language script meeting the expectation is rewritten into a compiled language, and the code of the compiled language is packaged in a dynamic library, and then the configuration item is modified to the first execution method implemented by the compiled language to perform positioning calculation, so as to improve the execution efficiency.

[0044] In the embodiment, when the accuracy of the positioning calculation of the execution result meets a predetermined value such as 99%, it is considered that the expectation is met, and the positioning algorithm is qualified and can be pushed to the client.

[0045] In some other embodiments, since the test environment of the intelligent beam light positioning system will appear magnetic field interference, which causes the data received by the detector to be abnormal, a filter needs to be designed in the positioning algorithm according to the abnormal data to eliminate abnormal values; until the abnormal values are eliminated in the execution result, it is considered that the expectation is met.

[0046] It should be noted that during testing, the tester will write a test case (equivalent to the upstream program). In the test case, the detector of the intelligent beam positioning system will be controlled to move in the three-dimensional space point along with the test frame. The test case will record the real three-dimensional coordinates of the detector and the positioning calculation results in real time. Finally, the difference between the real position and the positioning calculation results will be compared to evaluate the magnetic positioning accuracy in order to test the positioning algorithm. When the test case is running, the dynamic library will be loaded for positioning calculation. After each modification of the interpreted language script, you only need to rerun the test case.

[0047] Step S103: In response to receiving the call request for the predetermined function, the upstream software selects the first execution method or the second execution method for execution according to the execution method parameters configured in the configuration item; In this embodiment, during testing, the second execution method is configured in the configuration item. When a positioning calculation request is received, the upstream software instantiates the second strategy class corresponding to the second execution method based on the configuration item, and then calls the interpreted language (Python) script through the pybind11 third-party library to perform the positioning calculation. The specific steps include: Initialize the Python interpreter; Import the interpreted language script, create a Python class instance and obtain the Python method corresponding to the positioning algorithm; The compiled language (C++) converts the magnetic field data of the received positioning calculation request into a Numpy array through pybind11, and passes it to the Python method corresponding to the positioning algorithm for execution; Returns the execution result to the interpreted language strategy object via a json string.

[0048] Close the Python interpreter.

[0049] In some other implementations, a third library such as CLIF, CFFI, etc. may also be used to achieve intercommunication with C++.

[0050] In other implementations, interpreted languages ​​such as Matlab, Ruby, and Lua may be used to develop positioning algorithms, and corresponding third-party libraries may be used to achieve interoperability with C++.

[0051] It can be understood that the third-party library referred to in this application is a cross-language operation library that is not included in the standard library and requires additional integration. The third-party library acts as a bridge between compiled languages ​​and interpreted languages ​​to achieve two-way data transmission between compiled languages ​​and interpreted languages.

[0052] In the embodiment, when the client uses, the first execution method is configured in the configuration item, and when the positioning calculation request is received, the upstream software instantiates the first strategy class according to the configuration item, and directly executes the predetermined function code written in the compiled language.

[0053] It can be understood that the positioning algorithm written in C++ is executed by using the strategy object of the compiled language, which ensures high execution efficiency in use.

[0054] In embodiment 1 of the present application, the coexistence and switching method of the interpreted language and the compiled language is applied in the intelligent light beam positioner system, the revolutionary balance of development efficiency and running performance is realized, the algorithm is modified in real time without compiling in the test development stage by means of the interpreted language (Python), the development efficiency is greatly improved; the compiled language (C++) strategy object is switched to in the deployment stage, the execution efficiency is guaranteed, and the real-time positioning performance is improved.

[0055] Embodiment 2 One embodiment of the present application provides a coexistence and switching method of an interpreted language and a compiled language, and the coexistence and switching method of the interpreted language and the compiled language in embodiment 2 of the present application is different from that in embodiment 1. The cross-language scheduling method in embodiment 2 of the present application is applied to image processing of a flat panel detector, a lot of image preprocessing and post-processing algorithms are included in the flat panel detector SDK, each algorithm needs to be tested and optimized, and each algorithm can be regarded as a predetermined function.

[0056] In the embodiment, since the matrix operation of the Matlab language is optimized and the Matlab language has a rich image processing function library, the Matlab language is used as the interpreted language to write the image processing algorithm function code, and the C++ language is selected as the compiled language.

[0057] In the embodiment, the Matlab Engine API is used as the cross-language bridging unit to realize the direct calling of Matlab by C++.

[0058] In the embodiment, the factory mode is used to configure the predetermined function, the predetermined function is configured to include a factory interface, the factory interface defines a creation method of a product for executing the predetermined function, the factory interface includes a first factory class and a second factory class; the first factory class is configured to create an instance of a first product class to realize a product interface of the predetermined function by using a first execution method; and the second factory class is configured to create an instance of a second product class to realize the product interface of the predetermined function by using a second execution method.

[0059] In the embodiment, the upstream software determines the first factory class or the second factory class in the example instantiation factory interface through a configuration item to implement the execution of the predetermined function in the first execution method or the second execution method, respectively.

[0060] It can be understood that the Matlab Engine API, as a cross-language bridging unit, has a function similar to the third-party library in Embodiment 1, and serves as a bridge between the compiled language (C++) and the interpreted language (Matlab) to realize bidirectional data transmission between the compiled language and the interpreted language.

[0061] In the embodiment, in the research and development test phase of the algorithm, the upstream software is instantiated with the second factory class by modifying the configuration item, and then the function code written in the Matlab language is modified to test and optimize the algorithm of the predetermined function. After the algorithm meets the expectation, the function code written in C++ is modified and encapsulated, the upstream software is instantiated with the first factory class by modifying the configuration item, and the image processing algorithm is executed in C++.

[0062] In the embodiment, after the function code written in C++ is modified and encapsulated, the first execution method and the second execution method are used for image processing, respectively, to perform cross-validation and ensure the consistency and accuracy of the results of the modified C++ code and the Matlab code.

[0063] Embodiment 3 In the embodiment, an electronic device is also provided, which includes a processor and a memory. The memory is configured to store non-transitory computer-readable instructions. The processor is configured to execute the non-transitory computer-readable instructions, and the non-transitory computer-readable instructions, when executed by the processor, can perform one or more steps of the coexistence and switching method of the interpreted language and the compiled language described above. The memory and the processor can be interconnected through a bus system and / or other forms of connection mechanism.

[0064] For example, the processor can be a central processing unit (CPU), a digital signal processor (DSP), or other forms of processing units with data processing capability and / or program execution capability, such as a field programmable gate array (FPGA), etc. For example, the central processing unit (CPU) can be X86 or ARM architecture, etc.

[0065] For example, the memory can include any combination of one or more computer program products. The computer program product can include various forms of computer-readable storage media, such as volatile and / or non-volatile computer-readable media. For example, volatile computer-readable media can include volatile memory such as random access memory (RAM), and / or cache memory, etc. Non-volatile computer-readable media can include, for example, read only memory (ROM), hard disks, erasable programmable read only memory (EPROM), portable compact disc read only memory (CD-ROM), USB memory, flash memory, etc. One or more computer program modules can be stored on the computer-readable storage media, and the processor can execute one or more computer program modules to implement various functions of the electronic device. Various application programs and various data used and / or generated by the application programs can also be stored in the computer-readable storage media.

[0066] It should be noted that the specific functions and technical effects of the electronic device in the embodiments of the present application can refer to the description of the coexistence and switching method of the interpreted language and the compiled language in the foregoing, which will not be described here.

[0067] Embodiment 4 In this embodiment, a computer-readable storage medium is also provided, and the storage medium is used to store non-transitory computer-readable instructions. For example, when the non-transitory computer-readable instructions are executed by a computer, one or more steps in the coexistence and switching method of the interpreted language and the compiled language according to the foregoing can be performed.

[0068] For example, the storage medium can be applied to the electronic device described above. For example, the storage medium can be the memory in the electronic device of embodiment 3. For example, the related description of the storage medium can refer to the corresponding description of the memory in the electronic device of embodiment 3, which will not be described here.

[0069] It should be noted that the storage medium (computer-readable medium) described above in the present application can be a computer-readable signal medium or a non-transitory computer-readable storage medium or any combination of the above two. The non-transitory computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples of the non-transitory computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read only memory (ROM), an erasable programmable read only memory (EPROM or flash memory), an optical fiber, a portable compact disk read only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0070] In this application, non-transitory computer-readable storage medium can be any tangible media that can store or carry the program codes for use by or in connection with the instruction execution system, apparatus, or device. In this application, the computer-readable signal medium can include a computer-readable instruction, data structures, program codes, or other data, which can be transmitted in baseband or as part of a carrier wave, including, but not limited to, an electromagnetic signal, optical, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the non-transitory computer-readable storage medium that can carry the program codes for use by or in connection with the instruction execution system, apparatus, or device. The program code carried by the computer-readable medium can be transmitted in any suitable medium, including, but not limited to, a wire, optical fiber, RF (radio frequency), or any suitable combination of the above.

[0071] The above computer-readable medium can be included in the above electronic device; or can exist separately from the electronic device and be not assembled into the electronic device.

[0072] The flowcharts and block diagrams in the drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, a segment, or a portion of code that contains one or more executable instructions for implementing the specified logic function. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the drawings. For example, two blocks noted in succession can in fact be executed substantially concurrently or in the reverse order, depending on the functionality involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by dedicated hardware-based systems that perform the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0073] The units described in the embodiments of the present application can be implemented by software, or can be implemented by hardware. In some cases, the name of the unit does not constitute a limitation on the unit itself.

[0074] The functions described above in the specification can be performed at least in part by one or more hardware logic components. For example, and without limitation, illustrative types of hardware logic components that can be used include Field-programmable Gate Arrays (FPGAs), Program-specific Integrated Circuits (ASICs), Program-specific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), etc.

[0075] The above description is merely exemplary of the application and the inventive concepts presented herein. It is not intended to limit the scope of the disclosure in any way, but rather to provide insight into the principles and concepts of the application. It will be apparent to one skilled in the art that numerous changes can be made without departing from the scope of the disclosure. For example, the above-described features and applications can be combined in any number of ways. One skilled in the art will appreciate that the disclosure is intended to cover any and all modifications within the scope of the concepts disclosed herein. Thus, the scope of the disclosure should in no way be limited by the application of the illustrative embodiments described herein, but should be given the broadest interpretation of the principles and new concepts described.

[0076] Furthermore, while operations are depicted in a particular, chronological sequence in this disclosure, this should not be understood as requiring such order unless specifically specified. One of ordinary skill in the art will recognize that many activities can be performed in parallel or in any order, unless otherwise specifically stated. In addition, while a number of specific implementation details are discussed herein, these should not be construed as limiting the scope of the disclosure, but rather as providing examples of implementations. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub-combination. Moreover, although features can be described above as being implemented in particular embodiments, this and similar features can also be implemented in combination in a single embodiment and / or in sub-combination.

[0077] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims

1. A method for coexistence and switching between interpreted and compiled languages, characterized in that: include: Configuring a first execution method and a second execution method for a predetermined function, wherein the first execution method executes a code written in a compiled language corresponding to the predetermined function, and the second execution method calls and executes a code written in an interpreted language corresponding to the predetermined function; Based on the requirements of the execution method of the predetermined function, configure the parameters of the corresponding execution method in the configuration item; In response to receiving a call request for a predetermined function, the upstream software selects the first execution method or the second execution method for execution according to the parameters of the execution method configured in the configuration item.

2. The method for coexistence and switching between interpreted and compiled languages ​​according to claim 1, wherein: The predetermined function is configured to include a policy interface, the policy interface includes a first policy class and a second policy class, the first policy class is configured to execute the first execution method, and the second policy class is configured to execute the second execution method.

3. The method for coexistence and switching between interpreted and compiled languages ​​according to claim 1, wherein: The predetermined function is configured to include a factory interface, which defines a method for creating a product that performs the predetermined function. The factory interface includes a first factory class and a second factory class; the first factory class is configured to create an instance of a first product class, and implement the product interface of the predetermined function with the first execution method; the second factory class is configured to create an instance of a second product class, and implement the product interface of the predetermined function with the second execution method.

4. The method for coexistence and switching between interpreted and compiled languages ​​according to claim 1, wherein: The predetermined functions are packaged as a library file.

5. The method for coexistence and switching between interpreted and compiled languages ​​according to claim 4, wherein: The method further comprises: In the configuration item, modify the parameters of the execution method to the second execution method, and modify the interpreted language script until the execution result meets the expectations.

6. The method for coexistence and switching between interpreted and compiled languages ​​according to claim 1, wherein: The interpreted languages ​​include but are not limited to Python and Matlab, and the compiled languages ​​include any one of C++ and Java.

7. The method for coexistence and switching between interpreted and compiled languages ​​according to claim 1, wherein: The second execution method calls and executes a code written in an interpreted language corresponding to a predetermined function through a third-party library or a cross-language bridging unit.

8. An electronic device, characterized in that: include: processor; a memory storing one or more computer instructions to be executed by the processor; When the processor runs the computer instructions, it executes the coexistence and switching method of the interpreted language and the compiled language according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that Computer instructions are stored thereon, and when the computer instructions are executed by the processor, the steps of the coexistence and switching method of the interpreted language and the compiled language as described in any one of claims 1 to 7 are executed.