CN116737273A - Programming language extension method, system, computing device and storage medium - Google Patents

Programming language extension method, system, computing device and storage medium Download PDF

Info

Publication number
CN116737273A
CN116737273A CN202310737375.5A CN202310737375A CN116737273A CN 116737273 A CN116737273 A CN 116737273A CN 202310737375 A CN202310737375 A CN 202310737375A CN 116737273 A CN116737273 A CN 116737273A
Authority
CN
China
Prior art keywords
language
plug
service
new
programming language
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.)
Pending
Application number
CN202310737375.5A
Other languages
Chinese (zh)
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.)
Uniontech Software Technology Co Ltd
Original Assignee
Uniontech Software 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 Uniontech Software Technology Co Ltd filed Critical Uniontech Software Technology Co Ltd
Priority to CN202310737375.5A priority Critical patent/CN116737273A/en
Publication of CN116737273A publication Critical patent/CN116737273A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/541Interprogram communication via adapters, e.g. between incompatible applications

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The invention discloses a programming language expansion method, a system, a computing device and a storage medium, wherein the method is executed at the front end to expand a new programming language, and the front end comprises a business plug-in and is suitable for accessing a new language plug-in corresponding to the new programming language; the method comprises the following steps: loading a business plugin based on the new programming language; acquiring new language function parameters from a new language plug-in corresponding to the new programming language through a service plug-in; and sending a function service calling request to a corresponding intermediate protocol adapter at the rear end based on the new language function parameters through the service plug-in, so as to request the intermediate protocol adapter to load the corresponding language function service plug-in according to the new language function parameters, so as to communicate with the language function service plug-in and call the function service provided by the language function service plug-in. According to the technical scheme of the invention, the language expansibility is enhanced, and the dependency relationship among the plugins is decoupled.

Description

Programming language extension method, system, computing device and storage medium
Technical Field
The present invention relates to the field of application development technologies, and in particular, to a programming language extension method, a programming language extension system, a computing device, and a storage medium.
Background
IDE (Integrated Development Environment ) is an application program for providing a program development environment, and generally includes tools such as a code editor, compiler, debugger, and graphical user interface.
At present, the programming language is endless, and the requirements on the language expansion capability of IDE are also higher and higher. In the prior art, for QtCreator, pycharm, the specific IDE has relatively strong support language and weak expansion capability. The VSCode is used as a universal editor and development tool, has strong expansion capability, but is realized based on an Electron and TS technology stack, and although simplifying the complexity of IDE development, performance is sacrificed due to the existence of an interpreter, and the architecture of the VSCode is not suitable for compiled language development. QtCreater is a very widely used IDE tool in the Linux platform, developed primarily for the C/C++ language.
The language-related functions of the QtCreater are realized by loading different plugins, the compiling-related functions are realized in a cmakejectmanager plugin, the debugging-related functions are realized in a debug plugin, and logic in the projectexplorer plugin is directly relied on in the debug plugin, so that the plugin lacks decoupling operation. In addition, although the qtceater implements related functions based on a plug-in manner, expansibility is not considered, logic inside the plug-in is too heavy, and code related to language is written in the core service plug-in 211 (compiling and debugging) of the IDE, which results in that the code inside the core service plug-in needs to be modified when a new language is expanded, which obviously does not conform to the switching principle. And, the tool chain is realized by adopting a direct calling mode, and as the language service and the debugging service consume resources, the direct calling in the IDE occupies the resources of the IDE and affects the efficiency. The QtCreater has the problems of weak expansibility, strong dependence among plug-ins and uncoupling of service.
In view of this, there is a need for a programming language extension method to solve the above-mentioned problems.
Disclosure of Invention
Accordingly, the present invention provides a programming language extension method and system to solve or at least alleviate the above-mentioned problems.
According to one aspect of the present invention, there is provided a programming language extension method adapted to be executed at a front end for extending a new programming language, the front end comprising a service plug-in and adapted to access a new language plug-in corresponding to the new programming language; the method comprises the following steps: loading a business plugin based on the new programming language; acquiring new language function parameters from a new language plugin corresponding to the new programming language through the service plugin; and sending a function service calling request to a corresponding intermediate protocol adapter at the rear end based on the new language function parameters through the service plug-in, so as to request the intermediate protocol adapter to load the corresponding language function service plug-in according to the new language function parameters, so as to communicate with the language function service plug-in and call the function service provided by the language function service plug-in.
Optionally, according to the programming language extension method of the present invention, the intermediate protocol adapter is adapted to obtain a port number corresponding to the new programming language from the language function service plug-in; the method further comprises: acquiring the port number returned by the intermediate protocol adapter through the service plug-in; and requesting to establish language connection to the intermediate protocol adapter according to the port number so as to communicate with the language function service plug-in via the intermediate protocol adapter and call the function service provided by the language function service plug-in.
Optionally, according to the programming language extension method of the present invention, the intermediate protocol adapter is adapted to: and determining the programming language as a new programming language according to the new language function parameters, and loading a corresponding language function service plug-in according to the new programming language.
Optionally, according to the programming language extension method of the present invention, the front end is adapted to provide one or more service interfaces through independent plug-ins, so that the new language plug-in invokes the service interfaces to implement service logic corresponding to the service interfaces.
Optionally, according to the programming language extension method of the present invention, each service interface corresponds to a plurality of service plugins; the method further comprises the steps of: and calling the service interface through the new language plug-in to load a plurality of service plug-ins corresponding to the service interface.
Optionally, according to the programming language extension method of the present invention, the service interface includes a window service interface, and the method further includes: and calling the window service interface through the new language plug-in to embed a programming page corresponding to a new programming language into the front end.
Optionally, according to the programming language extension method of the present invention, the service interface includes a language service interface, and the new language plug-in is adapted to actively register with the language service interface, so as to provide, through the language service interface, a basic class required to be implemented by the new language plug-in.
Optionally, according to the programming language extension method of the present invention, the service plugin includes a debug plugin and a compile plugin.
Optionally, according to the programming language extension method of the present invention, the backend is adapted to access a language function service plug-in corresponding to the new programming language; the intermediate protocol adapter includes: a debug protocol adapter and a language service protocol adapter; the language function service plug-in comprises: debugging service plug-in and language service plug-in.
Optionally, according to the programming language extension method of the present invention, the language connection is a TCP connection based on a new programming language.
According to one aspect of the present invention, there is provided a programming language extension system, comprising: the front end comprises a business plug-in and is suitable for being connected with a new language plug-in corresponding to the new programming language; the back end comprises an intermediate protocol adapter and is suitable for accessing a language function service plug-in corresponding to the new programming language; wherein the front end is adapted to perform the method as described above to extend the new programming language.
According to one aspect of the invention, there is provided a computing device comprising: at least one processor; a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions comprising instructions for performing the programming language extension method as described above.
According to one aspect of the present invention, there is provided a readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform a programming language extension method as described above.
According to the technical scheme of the invention, a new language plug-in corresponding to a new programming language is accessed to the front end, when the new programming language is used by the front end, new language function parameters can be acquired from the new language plug-in corresponding to the new programming language through the service plug-in, a function service calling request is sent to a corresponding intermediate protocol adapter of the rear end based on the new language function parameters, and the intermediate protocol adapter can load the corresponding language function service plug-in according to the new language function parameters so as to establish communication connection with the language function service plug-in, so that function services provided by the language function service plug-in can be called. Therefore, according to the technical scheme of the invention, when a new programming language needs to be expanded, only plug-ins corresponding to the new programming language are needed to be respectively connected to the front end and the rear end, so that the function service matched with the new programming language can be realized, and the front end and the rear end do not need to modify codes, thereby enhancing the expansibility of the language, decoupling the dependency relationship among the plug-ins and realizing mutual isolation among the programming languages.
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
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which set forth the various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to fall within the scope of the claimed subject matter. The above, as well as additional objects, features, and advantages of the present disclosure will become more apparent from the following detailed description when read in conjunction with the accompanying drawings. Like reference numerals generally refer to like parts or elements throughout the present disclosure.
FIG. 1 shows a schematic diagram of a computing device 100 according to one embodiment of the invention;
FIG. 2 illustrates a schematic diagram of a programming language extension system 200, according to one embodiment of the invention;
FIG. 3 illustrates a flow diagram of a programming language extension method 300 according to one embodiment of the invention;
FIG. 4 illustrates a timing diagram of interactions between business plug-ins 211, new language plug-ins, intermediate protocol adapter 221, language function service plug-ins 222, according to one embodiment of the invention;
FIG. 5 illustrates a schematic diagram of a relationship of a service interface to a service plug-in according to one embodiment of the invention;
fig. 6 shows a schematic diagram of the relationship among the language plug-in 212, the service interface, and the business plug-in 211 according to one embodiment of the 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.
FIG. 1 shows a schematic diagram of a computing device 100 according to one embodiment of the invention. As shown in FIG. 1, in a basic configuration, computing device 100 includes at least one processing unit 102 and a system memory 104. According to one aspect, the processing unit 102 may be implemented as a processor, depending on the configuration and type of computing device. The system memory 104 includes, but is not limited to, volatile storage (e.g., random access memory), non-volatile storage (e.g., read only memory), flash memory, or any combination of such memories. According to one aspect, an operating system 105 is included in system memory 104.
According to one aspect, operating system 105 is suitable, for example, for controlling the operation of computing device 100. Further, examples are practiced in connection with a graphics library, other operating systems, or any other application program and are not limited to any particular application or system. This basic configuration is illustrated in fig. 1 by those components within the dashed line. According to one aspect, computing device 100 has additional features or functionality. For example, according to one aspect, computing device 100 includes additional data storage devices (removable and/or non-removable) such as, for example, magnetic disks, optical disks, or tape. Such additional storage is illustrated in fig. 1 by removable storage device 109 and non-removable storage device 110.
As set forth hereinabove, according to one aspect, the program module 103 is stored in the system memory 104. According to one aspect, program modules 103 may include one or more applications, the invention is not limited in the type of application, for example, the application may include: email and contacts applications, word processing applications, spreadsheet applications, database applications, slide show applications, drawing or computer-aided application, web browser applications, etc.
According to one aspect, program modules 103 may also include a plurality of program instructions for performing the programming language extension method 300 of the present invention for execution by the programming language extension method 300 of the present invention in the computing device 100.
According to one aspect, the examples may be practiced in a circuit comprising discrete electronic components, a packaged or integrated electronic chip containing logic gates, a circuit utilizing a microprocessor, or on a single chip containing electronic components or a microprocessor. For example, examples may be practiced via a system on a chip (SOC) in which each or many of the components shown in fig. 1 may be integrated on a single integrated circuit. According to one aspect, such SOC devices may include one or more processing units, graphics units, communication units, system virtualization units, and various application functions, all of which are integrated (or "burned") onto a chip substrate as a single integrated circuit. When operating via an SOC, the functionality described herein may be operated via dedicated logic integrated with other components of computing device 100 on a single integrated circuit (chip). Embodiments of the invention may also be practiced using other techniques capable of performing logical operations (e.g., AND, OR, AND NOT), including but NOT limited to mechanical, optical, fluidic, AND quantum techniques. In addition, embodiments of the invention may be practiced within a general purpose computer or in any other circuit or system.
According to one aspect, the computing device 100 may also have one or more input devices 112, such as a keyboard, mouse, pen, voice input device, touch input device, and the like. Output device(s) 114 such as a display, speakers, printer, etc. may also be included. The foregoing devices are examples and other devices may also be used. Computing device 100 may include one or more communication connections 116 that allow communication with other computing devices 118. Examples of suitable communication connections 116 include, but are not limited to: RF transmitter, receiver and/or transceiver circuitry; universal Serial Bus (USB), parallel and/or serial ports.
The term computer readable media as used herein includes computer storage media. Computer storage media may include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information (e.g., computer readable instructions, data structures, or program modules 103). System memory 104, removable storage 109, and non-removable storage 110 are all examples of computer storage media (i.e., memory storage). Computer storage media may include Random Access Memory (RAM), read Only Memory (ROM), electrically erasable read only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other article of manufacture that can be used to store information and that can be accessed by computer device 100. According to one aspect, any such computer storage media may be part of computing device 100. Computer storage media does not include a carrier wave or other propagated data signal.
According to one aspect, communication media is embodied by computer readable instructions, data structures, program modules 103, or other data in a modulated data signal (e.g., carrier wave or other transport mechanism) and includes any information delivery media. According to one aspect, the term "modulated data signal" describes a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio Frequency (RF), infrared, and other wireless media.
In an embodiment in accordance with the invention, the computing device 100 is configured to perform a programming language extension method 300 in accordance with the invention. The computing device 100 includes one or more processors and one or more readable storage media storing program instructions that, when configured to be executed by the one or more processors, cause the computing device to perform the programming language extension method 300 in an embodiment of the invention.
FIG. 2 illustrates a schematic diagram of a programming language extension system 200, according to one embodiment of the invention. As shown in fig. 2, the programming language extension system 200 includes a front end 210, a back end 220, and the front end 210 may establish a communication connection with the back end 220.
Wherein the front end 210 may be configured to perform the programming language extension method 300 of the present invention. The programming language extension method 300 of the present invention will be described in detail below.
In one embodiment, front end 210 may be implemented as an application in computing device 100, for example as an integrated development application (IDE), and deployed in program modules of computing device 100. When the front end 210 (integrated development application) is configured to perform the programming language extension method 300 of the present invention, extending a new programming language in the integrated development application may be implemented to develop a program using the new programming language.
In one embodiment, as shown in FIG. 2, front end 210 and back end 220 may include a business layer, a plug-in layer, and a tool layer, respectively.
In an embodiment of the invention, front end 210 (e.g., an integrated development application) includes one or more business plug-ins 211. And, the front end 210 may access language plug-ins 212 corresponding to each programming language, where one programming language corresponds to each language plug-in 212. Specifically, each service plug-in 211 is deployed at the service layer of the front end 210.
In one embodiment, business plug-ins 211 include, for example, debug plug-ins, compile plug-ins.
For example, in one embodiment, the plug-in layer of the front end 210 may include one or more language plug-ins 212 corresponding to one or more programming languages. It should be noted that each language plug-in 212 is configured to package special processing logic related to a corresponding programming language, such as processing logic for debugging, engineering tree generation, and the like.
The tool layer of the front end 210 may include a language tool chain corresponding to each of the language plug-ins described above. For example, the language tool chain may include: language engineering tools (for engineering organization, generating db data, e.g., cmake), language compilation tools (for language compilation, generating binary files, e.g., gcc, maven).
In some embodiments, programming languages include, for example, C/C++, java, python, etc., and for each programming language, a language plug-in 212 corresponding to the programming language may be accessed at the front end 210.
It should be noted that code related to the programming language is not written in the business plug-in 211 of the present invention. In an embodiment of the present invention, when a new programming language needs to be extended at the front end 210 (integrated development application), a new language plug-in corresponding to the new programming language may be accessed at the front end 210 without modifying the service plug-in 211. It will be appreciated that the new language plug-in is used to encapsulate special processing logic associated with the new programming language, such as processing logic for debugging, engineering tree generation, etc.
In an embodiment of the invention, backend 220 may include intermediate protocol adapters 221 corresponding to each business plug-in 211, including, for example, a debug protocol adapter (DAP adapter) corresponding to a debug plug-in, a language services protocol adapter (LSP adapter) corresponding to a compile plug-in. Wherein the debug plug-in may communicate with a debug protocol adapter via a Debug Adaptation Protocol (DAP), and the compile plug-in may communicate with a language service protocol adapter via a Language Service Protocol (LSP).
Based on the LSP language service protocol, functions such as highlighting grammar, symbol tree, grammar tree, etc. may be implemented. Based on the DAP debugging adaptation protocol, the common debugging functions of starting, running, breakpoint hit, single step jump-in, single step jump-out and the like of a debugged program can be realized, and the dependence of a business plug-in and an actual function service provider can be decoupled through the adaptation of an intermediate protocol, so that the programming language is conveniently expanded.
The backend 220 may also include language function service plug-ins 222 corresponding to one or more programming languages, respectively, the language function service plug-ins 222 being configured to provide corresponding function services for the front-end (business plug-ins). And, the backend 220 can access a language function service plug-in 222 (new language function service plug-in 222) corresponding to the new programming language in order to provide a function service adapted to the new programming language. Here, the language function service plug-ins 222 may include a plurality of kinds, and each language function service plug-in 222 corresponds to one kind of business plug-ins 211. For example, the language function service plug-in 222 includes a debug service plug-in (DAP plug in) corresponding to a debug plug-in, and a language service plug-in (LSP plug in) corresponding to a compile plug-in.
Here, a debug service plugin (DAP plugin) may encapsulate debug functions related to a corresponding programming language in order to provide debug services. A language services plug-in (LSP plug in) may encapsulate syntax, semantic functions associated with the corresponding programming language in order to provide a syntax service.
It should be noted that, the intermediate protocol adapter of the back end is mainly used for distinguishing data of different programming languages and forwarding data, and specific logic can be implemented in the corresponding language function service plug-in.
In one embodiment, the tool layer of the backend 220 may include a language services tool chain corresponding to each of the language function services plug-ins 222 described above. For example, the language services tool chain may include, for example: debug service tools (packages of debug service providers, e.g. gdb, jdb, pdb), language service tools (packages of grammar service providers, e.g. classified).
FIG. 3 illustrates a flow diagram of a programming language extension method 300 according to one embodiment of the invention. The method 300 is adapted to be performed at the front end 210 (in the computing device 100).
As shown in fig. 3, method 300 begins at step 310.
First, in step 310, the business plugin 211 is loaded based on the new programming language.
Specifically, when the front end 210 (integrated development application) uses a new programming language, for example, when a program is developed using the new programming language, the corresponding service plug-in 211 (debug plug-in/compile plug-in) may be loaded according to a function (for example, debug function/compile function) to be used. It is understood that the business plug-in 211 loaded in step 310 may be a debug plug-in or a compilation plug-in.
Subsequently, in step 320, new language function parameters are obtained from the new language plug-ins corresponding to the new programming language through the service plug-in 211. Here, the new language function parameters may include related data of the intermediate protocol adapter 221.
By loading the service plug-in 211, a service flow corresponding to the service plug-in 211 may be implemented. For example, by loading a debug plug-in, a debug-related business process may be implemented. However, the corresponding function parameters (i.e., debug parameters for the debug plug-ins) for each programming language are different and related to the programming language, based on which the business plug-in 211 can load the corresponding new language plug-in according to the new programming language in order to obtain new language function parameters (related to the new programming language) from the new language plug-in. Here, the new language function parameter may include related data of the intermediate protocol adapter 221, for example, when the service plug-in 211 is a debug plug-in, the new language function parameter may include related data of a debug protocol adapter (DAP adapter).
Next, in step 330, through the service plug-in 211, a function service call request is sent to the corresponding intermediate protocol adapter 221 of the back end 220 based on the new language function parameter (the new language function parameter is included in the function service call request), so as to request the intermediate protocol adapter 221 to load the corresponding language function service plug-in 222 according to the new language function parameter, so as to communicate with the language function service plug-in 222, and implement calling the function service provided by the language function service plug-in 222 (for example, a debugging service provided by a debugging service plug-in or a grammar service provided by a language service plug-in).
Specifically, after receiving the function service call request from the service plug-in 211, the intermediate protocol adaptor 221 may determine, according to the new language function parameter in the function service call request, that the programming language used by the front end 210 is a new programming language, and further may load, according to the determined new programming language, the language function service plug-in 222 corresponding to the new programming language.
For example, in one embodiment, when the service plug-in 211 is a debug plug-in, the new language function parameter may include data related to a debug protocol adapter (DAP adapter), so that the debug plug-in may send a debug request to the debug protocol adapter of the backend 220 based on the new language function parameter to request the debug protocol adapter to load a corresponding debug service plug-in (DAP plug-in) according to the new language function parameter, so that communication with the debug service plug-in may be performed, and a debug service provided by the debug service plug-in may be invoked.
In one implementation, the business plug-in 211 may send a function service call request to the corresponding intermediate protocol adapter 221 over the D-Bus.
It should be noted that through the language function service plug-in 222, function adaptation may be performed for different programming languages in order to access function services adapted to the new programming language. Thus, when a new programming language needs to be expanded, by accessing a corresponding new language plug-in at the front end 210 and accessing a language function service plug-in 222 corresponding to the new programming language at the back end 220, the function service adapted to the new programming language can be provided by the language function service plug-in 222 of the back end 220 when the new programming language is used at the front end 210. The front-end 220 only needs to access the plug-in, and no code modification is needed.
FIG. 4 illustrates a timing diagram of interactions between business plug-ins 211, new language plug-ins, intermediate protocol adapter 221, language function service plug-ins 222, according to one embodiment of the invention.
As shown in fig. 4, in one embodiment, after loading the corresponding language function service plug-in 222 (corresponding to the new programming language) according to the new language function parameter, the intermediate protocol adapter 221 may obtain the port number corresponding to the new programming language from the language function service plug-in 222, and return the port number to the service plug-in 211.
After acquiring the port number corresponding to the new programming language returned by the intermediate protocol adapter 221, the service plug-in 211 may request to establish a language connection (a language connection based on the new programming language) to the intermediate protocol adapter 221 based on the port number, and then, the intermediate protocol adapter 221 may return a connection state to the service plug-in 211. After the service plug-in 211 determines that the language connection is successful according to the connection state, the front end 210 may perform data transmission (send request and response) with the back end 220. Specifically, after the connection is successful, the business plug-in 211 may communicate with the language function service plug-in 222 via the intermediate protocol adapter 221 to call the function service provided by the language function service plug-in 222. Here, the language connection may specifically be a TCP connection based on a new programming language, and by establishing the language connection, a C/S architecture is formed between the front end and the back end, so as to weaken the concept of the caller and the callee.
As shown in fig. 4, after establishing a language connection is successful, the service plug-in 211 may send a request to the intermediate protocol adapter 221 based on the language connection, the intermediate protocol adapter 221 sends the request to the language function service plug-in 222, the language function service plug-in 222 may return a response result to the intermediate protocol adapter 221, and the intermediate protocol adapter 221 then sends the response result to the service plug-in 211. In this way, the service plug-in 211 can communicate with the language function service plug-in 222 via the intermediate protocol adapter 221, send request and response data, and thus implement the function service provided by the calling language function service plug-in 222.
It should be noted that, the port numbers corresponding to each programming language are different, and thus, the TCP connection based on the new programming language is established with the intermediate protocol adapter 221 based on the port number corresponding to the new programming language.
For example, in one embodiment, when service plug-in 211 is a debug plug-in, the debug plug-in may send a debug request to the debug protocol adapter of backend 220 based on the new language functionality parameters. The debug protocol adapter may load (with the new programming language) the corresponding debug service plugin according to the new language functional parameters and obtain the port number corresponding to the new programming language from the debug service plugin, and then return the port number to the service plugin 211. In this way, the service plug-in 211 of the front end 210 may request to establish a language connection (a new programming language based TCP connection) with the corresponding debug protocol adapter according to the port number, so that the front end 210 and the back end 220 may perform data transmission (send request and response) based on the TCP connection. Specifically, after the connection is successful, the service plug-in 211 may communicate (send requests and responses) with the debug service plug-in via the debug protocol adapter to invoke the debug service provided by the debug service plug-in.
FIG. 5 illustrates a schematic diagram of a relationship of a service interface to a service plug-in according to one embodiment of the invention.
As shown in fig. 5, in one embodiment of the present invention, front end 210 may be configured to stand alone an independent plug-in based on a plug-in framework and provide one or more service interfaces through the independent plug-in for each language plug-in 212 to invoke a service interface. Here, the Service interfaces include, for example, service1, service2, service3, …. Each language plug-in 212 may retrieve these service interfaces through the context and make calls. Thus, the new language plug-in may also call the service interface described above to implement the service logic corresponding to the service interface. It should be noted that each language plug-in 212 may invoke a service interface in an active or passive invocation manner.
In one embodiment, each service interface may correspond to a plurality of service plug-ins (e.g., plugin 1-PluginN). In the method 300 of the present invention, when a new programming language is used (e.g., when an integrated development application is used to develop a program using the new programming language), the front end 210 may invoke the service interface through a new language plug-in corresponding to the new programming language to load a plurality of service plug-ins corresponding to the service interface.
In this way, service logic corresponding to a service interface can be implemented through a plurality of service plug-ins corresponding to the service interface. Therefore, the complete service logic is distributed to a plurality of service plugins corresponding to the service interfaces, and the granularity of the service plugins is reduced.
In one embodiment, each service plug-in (Plugin 1-PluginN) may be dynamically bound to a service interface. Specifically, each service plug-in can obtain a service interface through a service context environment and register a method required to be implemented by each service plug-in, so that dynamic binding between a plurality of service plug-ins and the service interface can be realized. Therefore, one service interface can correspond to a plurality of service plugins (implementers), so that one complete service logic is distributed to the plurality of service plugins, and the granularity of the service plugins is reduced.
Fig. 6 shows a schematic diagram of the relationship among the language plug-in 212, the service interface, and the business plug-in 211 according to one embodiment of the invention.
In one embodiment, the service logic corresponding to the service interface may be customized service logic. For example, the service interface may include a window service interface (window service), and the service logic corresponding to the window service interface may be to embed a programming page corresponding to the programming language in a predetermined position of the front end 210. Thus, in this embodiment, the window service interface may be invoked by the new language plug-in to embed programming pages corresponding to the new programming language into the front end 210.
In one embodiment, the service interfaces may also include a language service interface that may be used to provide the underlying classes that each language plug-in 212 needs to implement, and the language plug-in 212 may actively register itself with the language service interface. Thus, when the front end 210 accesses a new language plug-in corresponding to the new programming language, the new language plug-in may actively register with the language service interface, so that a basic class required to be implemented by the new language plug-in may be provided through the language service interface.
In addition, some business plug-ins 211 (e.g., debug plug-ins) may call language service interfaces to perform corresponding operations when running to a specified location in order to complete a particular business process.
In addition, it should be noted that, the service plug-in at the front end may implement the basic class of the corresponding service according to the language characteristics of the new programming language and the differences of the tool chain parameters, the running environment, and the like. For example, for debug functions, although implemented based on the DAP protocol, and most of the request packet formats have been fixed, some parameters may be flexibly defined, such as the possible differences in start-up requests for different programming languages for which processing needs to be handled in business subclasses. The same can be generalized to other businesses. In addition, tool packages for different programming languages may also be implemented in a business card. For example, for C++, a CMak tissue engineering structure is required and gcc may be used for compilation operations. The business processes of these tools are already present in the integrated development application, while the business logic for each programming language can be implemented in a business plug-in.
According to the programming language extension method 300 and the system 200 of the invention, through accessing a new language plugin corresponding to a new programming language at the front end, when the front end uses the new programming language, the new language function parameters can be obtained from the new language plugin corresponding to the new programming language through the service plugin, and a function service calling request is sent to a corresponding intermediate protocol adapter at the rear end based on the new language function parameters, and the intermediate protocol adapter can load the corresponding language function service plugin according to the new language function parameters so as to establish communication connection with the language function service plugin, thereby realizing the function service provided by the calling language function service plugin. Thus, according to the technical scheme of the invention, when a new programming language needs to be expanded, only plug-ins corresponding to the new programming language are needed to be respectively connected to the front end and the rear end, so that the function service matched with the new programming language can be realized, the front end and the rear end do not need to modify codes, the expansibility of the language is enhanced, the dependency relationship among the plug-ins is decoupled, and the mutual isolation among the programming languages is realized.
In addition, according to the technical scheme of the invention, the language plug-in can actively call the service plug-in bound by the service interface to realize corresponding service logic, thereby improving the degree of freedom of the language plug-in.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions of the methods and apparatus of the present invention, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U-drives, floppy diskettes, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the mobile terminal will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the programming language extension method of the present invention in accordance with instructions in said program code stored in the memory.
By way of example, and not limitation, readable media comprise readable storage media and communication media. The readable storage medium stores information such as computer readable instructions, data structures, program modules, or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with examples of the invention. 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. 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 or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into a plurality of sub-modules.
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.
Furthermore, some of the embodiments are described herein as methods or combinations of method elements that may be implemented by a processor of a computer system or by other means of performing the functions. Thus, a processor with the necessary instructions for implementing the described method or method element forms a means for implementing the method or method element. Furthermore, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is for carrying out the functions performed by the elements for carrying out the objects of the invention.
As used herein, unless otherwise specified the use of the ordinal terms "first," "second," "third," etc., to describe a general object merely denote different instances of like objects, and are not intended to imply that the objects so described must have a given order, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of the above description, will appreciate that other embodiments are contemplated within the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is intended to be illustrative, but not limiting, of the scope of the invention, which is defined by the appended claims.

Claims (13)

1. A programming language extension method adapted to be executed at a front end to extend a new programming language, the front end comprising a business plugin and being adapted to access a new language plugin corresponding to the new programming language; the method comprises the following steps:
loading a business plugin based on the new programming language;
acquiring new language function parameters from a new language plugin corresponding to the new programming language through the service plugin;
and sending a function service calling request to a corresponding intermediate protocol adapter at the rear end based on the new language function parameters through the service plug-in, so as to request the intermediate protocol adapter to load the corresponding language function service plug-in according to the new language function parameters, so as to communicate with the language function service plug-in and call the function service provided by the language function service plug-in.
2. The method of claim 1, wherein the intermediate protocol adapter is adapted to obtain a port number corresponding to the new programming language from the language function service plug-in; the method further comprises:
acquiring the port number returned by the intermediate protocol adapter through the service plug-in;
and requesting to establish language connection to the intermediate protocol adapter according to the port number so as to communicate with the language function service plug-in via the intermediate protocol adapter and call the function service provided by the language function service plug-in.
3. The method of claim 1 or 2, wherein the intermediate protocol adapter is adapted to: and determining the programming language as a new programming language according to the new language function parameters, and loading a corresponding language function service plug-in according to the new programming language.
4. The method of any one of claim 1 to 3, wherein,
the front end is adapted to provide one or more service interfaces through independent plug-ins, such that the new language plug-in invokes the service interfaces to implement service logic corresponding to the service interfaces.
5. The method of claim 4, wherein each of the service interfaces corresponds to a plurality of service plugins; the method further comprises the steps of:
and calling the service interface through the new language plug-in to load a plurality of service plug-ins corresponding to the service interface.
6. The method of any of claims 4-5, wherein the service interface comprises a window service interface, the method further comprising:
and calling the window service interface through the new language plug-in to embed a programming page corresponding to a new programming language into the front end.
7. The method of any of claims 4-6, wherein the service interface comprises a language service interface, the new language plug-in being adapted to actively register with the language service interface to provide a basic class of implementation required by the new language plug-in through the language service interface.
8. The method of any one of claim 1 to 7, wherein,
the business plug-in comprises a debugging plug-in and a compiling plug-in.
9. The method of any of claims 1-8, wherein the backend is adapted to access a language functionality service plug-in corresponding to the new programming language;
the intermediate protocol adapter includes: a debug protocol adapter and a language service protocol adapter;
the language function service plug-in comprises: debugging service plug-in and language service plug-in.
10. The method of any of claims 1-9, wherein the language connection is a new programming language based TCP connection.
11. A programming language extension system, comprising:
the front end comprises a business plug-in and is suitable for being connected with a new language plug-in corresponding to the new programming language;
the back end comprises an intermediate protocol adapter and is suitable for accessing a language function service plug-in corresponding to the new programming language;
wherein the front end is adapted to perform the method of any of claims 1-10 to extend a new programming language.
12. A computing device, comprising:
at least one processor; and
a memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any of claims 1-10.
13. A readable storage medium storing program instructions which, when read and executed by a computing device, cause the computing device to perform the method of any of claims 1-10.
CN202310737375.5A 2023-06-20 2023-06-20 Programming language extension method, system, computing device and storage medium Pending CN116737273A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310737375.5A CN116737273A (en) 2023-06-20 2023-06-20 Programming language extension method, system, computing device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310737375.5A CN116737273A (en) 2023-06-20 2023-06-20 Programming language extension method, system, computing device and storage medium

Publications (1)

Publication Number Publication Date
CN116737273A true CN116737273A (en) 2023-09-12

Family

ID=87900837

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310737375.5A Pending CN116737273A (en) 2023-06-20 2023-06-20 Programming language extension method, system, computing device and storage medium

Country Status (1)

Country Link
CN (1) CN116737273A (en)

Similar Documents

Publication Publication Date Title
CN108255545B (en) Function calling method and device between components and modular architecture system
US8832656B2 (en) Testing systems and methods for a resource constrained device
US20080163265A1 (en) System and method for reducing the static footprint of mixed-language java classes
US6986124B1 (en) Debugger protocol generator
EP1301854B1 (en) Method and apparatus for creating efficient native methods that extend a bytecode interpreter
CN113407362A (en) SOMEIP communication intermediate layer implementation method and system based on SOA architecture of vehicle-mounted Android system
US20230297348A1 (en) Method for operating second system application on first system, terminal device and storage medium
CN105094910A (en) Driving function user state debugging system and method
US6898786B1 (en) Javascript interpreter engine written in Java
CN113703862A (en) Configuration-based interface calling method, device, equipment and storage medium
CN109542464B (en) Development and deployment system, method and storage medium of IoT (Internet of things) equipment script program
US8990515B2 (en) Aliasing buffers
CN112905271A (en) Calling method and device of application program interface API and electronic equipment
CN116185495B (en) Computing function construction method, computing engine, electronic device and readable storage medium
CN116737273A (en) Programming language extension method, system, computing device and storage medium
JP2007226784A (en) Calling method of in-lined method, and java virtual machine using it
CN111045746A (en) Code expansion method and framework
CN113986744A (en) Method and device for testing warehouse and table components and storage medium
CN110275710B (en) Java local interface consistency checking method and system, storage medium and terminal
US20020038454A1 (en) Method of compiling code in an object oriented programming language
EP1337915A1 (en) Formal verification in particular of a secured virtual machine
CN114443316B (en) Object access method and device and electronic equipment
US11645082B2 (en) Programming language trigger mechanisms for parallel asynchronous enumerations
CN111209056B (en) Method and device for loading function, readable storage medium and electronic equipment
WO2023208012A1 (en) Program processing method and apparatus, program running method and apparatus, terminal, smart card and storage medium

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