[go: up one dir, main page]

CN111381817A - Method, device, medium and electronic equipment for realizing cross-platform multi-language development - Google Patents

Method, device, medium and electronic equipment for realizing cross-platform multi-language development Download PDF

Info

Publication number
CN111381817A
CN111381817A CN202010220564.1A CN202010220564A CN111381817A CN 111381817 A CN111381817 A CN 111381817A CN 202010220564 A CN202010220564 A CN 202010220564A CN 111381817 A CN111381817 A CN 111381817A
Authority
CN
China
Prior art keywords
programming language
programming languages
cross
language
programming
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
CN202010220564.1A
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.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202010220564.1A priority Critical patent/CN111381817A/en
Publication of CN111381817A publication Critical patent/CN111381817A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting

Landscapes

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

Abstract

The present disclosure provides a method, apparatus, medium, and electronic device for implementing cross-platform multi-language development. The method comprises the following steps: acquiring a first mixed code set; analyzing the first mixed code set to obtain a first fragment code corresponding to each programming language; analyzing all first segment codes corresponding to the programming languages based on a syntax analysis model of each programming language, and respectively generating first abstract syntax trees corresponding to the programming languages; respectively compiling first abstract syntax trees corresponding to the programming languages by using a cross-platform framework compiler of each programming language, and respectively generating core binary files corresponding to the programming languages; the core binary file can be run in a virtual machine of a cross-platform framework.

Description

Method, device, medium and electronic equipment for realizing cross-platform multi-language development
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a medium, and an electronic device for implementing cross-platform multi-language development.
Background
The Flutter framework is an open-source mobile application development framework, and can enable a runnable program to achieve cross-platform, high fidelity and high performance. Namely, a set of codes of the executable program can run on the iOS platform or the Android platform. The Flutter framework provides rich components, interfaces, and enables developers to quickly add local extensions to the Flutter framework.
The flute framework adopts a Dart language as a development language, the Dart language is a static language which uses a specific Dart VM virtual machine to run, and provides a high-speed compilation before running (Ahead Of Time for short, AOT) scheme and a just-in-Time dynamic compilation (JIT) scheme for emphasizing dynamic property. The Dart VM virtual machine provides a runtime environment for the high-level programming language Dart language. Dart Kernel is a proprietary language of the IR levels supported by the Dart VM virtual machine. And compiling the code written by the Dart language, and converting the code into Dart Kernel and running in a Dart VM virtual machine.
However, the development of the Dart language is only supported under the Flutter framework, and the Dart language is limited by grammatical and engineering characteristics due to the characteristics of the Dart language and the ecological environment, so that the development effect is limited.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
An object of the present disclosure is to provide a method, an apparatus, a medium, and an electronic device for implementing cross-platform multi-language development, which can solve at least one of the above-mentioned technical problems. The specific scheme is as follows:
according to a specific embodiment of the present disclosure, in a first aspect, the present disclosure provides a method for implementing cross-platform multi-language development, including:
acquiring a first mixed code set; the first mixed code set comprises a plurality of first segment codes based on a plurality of programming languages, and each first segment code comprises code of one programming language;
analyzing the first mixed code set to obtain a first fragment code corresponding to each programming language;
analyzing all first segment codes corresponding to the programming languages based on a syntax analysis model of each programming language, and respectively generating first abstract syntax trees corresponding to the programming languages;
respectively compiling first abstract syntax trees corresponding to the programming languages by using a cross-platform framework compiler of each programming language, and respectively generating core binary files corresponding to the programming languages; the core binary file can be run in a virtual machine of a cross-platform framework.
According to a specific embodiment of the present disclosure, in a second aspect, the present disclosure provides an apparatus for implementing cross-platform multi-language development, including:
an acquisition unit configured to acquire a first mixed code set; the first mixed code set is used for defining preset processing logic and comprises a plurality of first section codes; wherein each first fragment code comprises code of one of a plurality of programming languages;
a first section code obtaining unit, configured to analyze the first mixed code set and obtain at least one or more first section codes corresponding to each programming language;
the analysis unit is used for analyzing all first segment codes corresponding to the programming languages based on a syntax analysis model of each programming language and respectively generating first abstract syntax trees corresponding to the programming languages;
the generating unit is used for compiling the first abstract syntax trees corresponding to the programming languages by utilizing a cross-platform framework compiler of each programming language and respectively generating core binary files corresponding to the programming languages; the core binary file can run in a virtual machine of a cross-platform framework;
and the calling unit is used for sequentially calling the core binary files running in the cross-platform framework virtual machine through a preset platform application program.
According to a third aspect, the present disclosure provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of implementing cross-platform multi-language development as described in any one of the first aspects.
According to a fourth aspect thereof, the present disclosure provides an electronic device, comprising: one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a method of implementing cross-platform multi-lingual development as described in any of the first aspects.
Compared with the prior art, the scheme of the embodiment of the disclosure at least has the following beneficial effects:
the present disclosure provides a method, apparatus, medium, and electronic device for implementing cross-platform multi-language development. The utility model provides a multi-language hybrid development's solution under the flute frame based on, can support the hybrid development of different programming languages, through generating abstract syntax tree with the code fragment of different programming languages, based on abstract syntax tree conversion journey binary file, just so can realize the hybrid loading to Dart Kernel language, this scheme can compatible different programming languages and exert the grammatical advantage and the engineering advantage of different programming languages, make the code of development more succinct, the execution of being more convenient for.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale. In the drawings:
FIG. 1 illustrates a flow diagram of a method of implementing cross-platform multi-language development in accordance with an embodiment of the present disclosure;
FIG. 2 illustrates a schematic diagram of a method of implementing cross-platform multi-language development in accordance with an embodiment of the present disclosure;
FIG. 3 illustrates a block diagram of elements of an apparatus for enabling cross-platform multi-language development, in accordance with an embodiment of the present disclosure;
fig. 4 shows an electronic device connection structure schematic according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "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"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
Alternative embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
The first embodiment provided by the present disclosure, namely, an embodiment of a method for implementing cross-platform multi-language development.
The embodiments of the present disclosure will be described in detail below with reference to fig. 1 and 2.
Step S101, a first mixed code set is obtained.
The method and the system are applied to a cross-platform framework, and a set of development codes can run in a plurality of system platforms under the cross-platform framework. All cross-platform frameworks with high code complexity and difficult maintenance problems can be applied to the method of the embodiment of the disclosure. The cross-platform framework comprises a Flutter framework. The Flutter framework is an open-source mobile application development framework and enables a runnable program to run across platforms. For example, under the Flutter framework, a set of development codes can be run on both the iOS platform and the Android platform. Under the Flutter framework, developers can be concentrated and concentrate on building application content, rather than being at the expense of the problem of the target platform before each development. In the multi-device and multi-platform world, the Flutter framework aims to provide a set of universal framework and development tools, so that developers are free from the limitation of devices and machine types, and smoothly create a first-class user experience. The Flutter engine driven by the high-level programming language Dart helps a developer to realize rapid development through a hot reload function for keeping an application state, and in addition, the Flutter engine can provide excellent local compiling support no matter on a mobile terminal, a desktop terminal, a web terminal or an embedded device, so that rapid and powerful performance is brought to the developer. And the method can deliver consistent experience for users, and under a proper condition, code multiplexing is realized on three platforms, namely a mobile end, a web end and a desktop. The Flutter framework is unique in that it only requires a set of reference codes to support a rich native compilation experience.
The virtual machines under the cross-platform framework comprise Dart VM virtual machines under the Flutter framework. The Dart VM virtual machine provides an execution environment for the high-level programming language Dart. Development of only the Dart language is supported under the Flutter framework. However, due to the limitations of the Dart language in language features and development environments, the complex hierarchical structure, continuous hierarchy indentation and nesting, is caused when the Dart language is adopted for development. To support the application of existing mature programming languages to the Flutter framework, for example, Html, javascript, typescript, and Dart languages. The embodiment of the disclosure provides a method for realizing cross-platform multi-language development.
The first mixed code set includes a plurality of first segment codes based on a plurality of programming languages, and each first segment code includes code of one programming language.
Referring to fig. 2, in the embodiment of the present disclosure, codes of different programming languages in an application are stored in different files, and the codes of all the files form a first mixed code set. The first mixed code set is used for defining preset processing logic, and when the first mixed code set is compiled, the corresponding executable program can complete the function related to the preset processing logic. For example, HTML codes are adopted for demo1.HTML files, and JS codes are adopted for demo2.JS files; HTML file and demo2.JS file are part of the same application and define part of the preset processing logic respectively, then JS language code and HTML code in the two files become part of the first mixed code set. And after the first mixed code is compiled, corresponding functions in the executable program are respectively completed.
In the above example, each file stores code of one programming language, i.e., one fragment code. All files of the same application are placed under the same main directory, and files of the same programming language are placed under the same subdirectory of the main directory, each subdirectory containing a language. Programming language type information, program run entry information, and exposed interface information. For example, HTML code is included in demo1.HTML file, JS language code is included in demo2.JS file; the HTML code in the demo1.HTML file is a fragment code and the JS language code in the demo2.JS file is also a fragment code.
Step S102, analyzing the first mixed code set, and acquiring a first segment code corresponding to each programming language.
In the embodiment of the disclosure, the fragment management tool reads the language.conf file in each subdirectory to acquire the programming language type information. Thereby obtaining a first fragment code corresponding to each programming language. For example, as shown in fig. 2, the first section code a, the first section code B, and the first section code C respectively represent codes corresponding to different programming languages.
Step S103, analyzing all first segment codes corresponding to the programming languages based on the syntactic analysis model of each programming language, and respectively generating first abstract syntactic trees corresponding to the programming languages.
The syntactic analysis model is a tool written for the first piece of code that analyzes the semantics and word senses of the first piece of code. Under the Flutter framework, the parsing model includes a front-end Compiler (CFE), which converts the first segment code into a first abstract syntax tree. Since each programming language has different syntax and its corresponding parsing model is different, for the first segment code of different programming languages, the corresponding parsing model needs to be applied. In the embodiment of the disclosure, the fragment management tool reads the language.conf file in each subdirectory to acquire the programming language type information. Then, the method according to the embodiment of the present disclosure calls the corresponding parsing model and cross-platform framework compiler for different programming language type information. The cross-platform framework compiler can generate a core binary file under the cross-platform framework according to the abstract syntax tree. For example, as shown in fig. 2, the front-end compiler a, the front-end compiler B, and the front-end compiler C respectively represent front-end compilers corresponding to different programming language types.
An Abstract Syntax Tree (AST) is a tree representation of the abstract syntax structure of the source code. Each node on the tree represents a structure in the source code. The syntax is said to be "abstract" in that the syntax does not represent every detail that appears in the true syntax. Because the syntax of each programming language is different, the characteristics and properties of the first abstract syntax tree generated by the corresponding first fragment code are also different.
The parsing model based on each programming language analyzes all first segment codes corresponding to the programming language and respectively generates a first abstract syntax tree corresponding to the programming language, comprising the following steps:
step S103-1, analyzing all first segment codes corresponding to each programming language based on a front-end compiler of each programming language, and respectively generating first abstract syntax trees corresponding to the programming languages.
And step S104, compiling the first abstract syntax trees corresponding to the programming languages by using a cross-platform framework compiler of each programming language, and generating core binary files corresponding to the programming languages respectively. Since the first abstract syntax tree for each programming language is different, the cross-platform framework compiler for the first abstract syntax tree is also different.
The cross-platform framework compiler is a compilation tool written for the first abstract syntax tree. The core binary file under the cross-platform framework can be generated according to the abstract syntax tree.
Compilation is simply the conversion of a high-level language into a binary language that can be recognized by a computer.
The Kernel Binary file (full name Kernel Binary) can be run in a virtual machine of a cross-platform framework.
The cross-platform framework comprises a Flutter framework.
Under the Flutter framework, the virtual machines include Dart VM virtual machines. However, the Dart VM virtual machine does not run the Dart source code directly, but executes a core binary file that includes a dill-suffixed file. The core binary implementation can be made to run across platforms in a Dart VM virtual machine. The cross-platform framework Compiler includes a core Compiler (called Kernel Compiler) and a Transformer (called Transformer). Because the first abstract syntax tree of each programming language has different characteristics and properties, the cross-platform framework compilers corresponding to different programming languages are different. For example, as shown in fig. 2, a cross-platform framework compiler a, a cross-platform framework compiler B, and a cross-platform framework compiler C respectively represent cross-platform framework compilers corresponding to different programming language types. But the corresponding first abstract syntax tree is converted into a specific language of IR level of Dart language through core compilers and converters of different programming languages, respectively. That is, each first segment code is generated into a file with a dill suffix. I.e. to convert different first pieces of code written in different programming languages into the same file form that can be run in the Flutter framework Dart VM virtual machine.
The method comprises the following steps of compiling first abstract syntax trees corresponding to the programming languages by using a cross-platform framework compiler of each programming language respectively, and generating core binary files corresponding to the programming languages respectively, wherein the cross-platform framework compiler comprises the following steps:
step S104-1, respectively compiling the first abstract syntax trees corresponding to the programming languages by using a core compiler of each programming language, and respectively generating first coding codes corresponding to the programming languages.
The first coding is also binary code. But the first compiled code at this time cannot run in the Flutter framework Dart VM virtual machine.
And step S104-2, respectively converting the first compiled codes of the programming languages by using a converter of each programming language to generate a core binary file corresponding to the programming language.
The core binary is a binary that can run in the Flutter framework Dart VM virtual machine.
And sequentially calling the core binary files running in the cross-platform framework virtual machine through a preset platform application program.
The preset platform application is an application running under an iOS platform or an Android platform. Attribute values and methods in the core binary file may be invoked by declaring the core binary file in the default platform application. The pre-set platform application may not have to run in a cross-platform framework virtual machine. The core binary file can be merged into the cross-platform framework only by running the core binary file in the cross-platform framework virtual machine.
The embodiment of the disclosure provides a multi-language hybrid development solution based on a Flutter framework, which can support hybrid development of different programming languages, and can realize hybrid loading of Dart Kernel language by generating abstract syntax trees from code segments of different programming languages and converting a program binary file based on the abstract syntax trees.
Corresponding to the first embodiment provided by the present disclosure, the present disclosure also provides a second embodiment, that is, an apparatus for implementing cross-platform multi-language development. Since the second embodiment is basically similar to the first embodiment, the description is simple, and the relevant portions should be referred to the corresponding description of the first embodiment. The device embodiments described below are merely illustrative.
Fig. 3 illustrates an embodiment of an apparatus for implementing cross-platform multi-language development provided by the present disclosure. Fig. 3 is a block diagram of elements of an apparatus for implementing cross-platform multi-language development according to an embodiment of the present disclosure.
Referring to fig. 3, the present disclosure provides an apparatus for implementing cross-platform multi-language development, including: an acquiring unit 301, an acquiring first segment code unit 302, an analyzing unit 303, and a generating unit 304.
An obtaining unit 301, configured to obtain a first mixed code set; the first mixed code set comprises a plurality of first segment codes based on a plurality of programming languages, and each first segment code comprises code of one programming language;
a get first section code unit 302, configured to analyze the first mixed code set and get a first section code corresponding to each programming language;
an analyzing unit 303, configured to analyze all first segment codes corresponding to each programming language based on a syntax analysis model of the programming language, and generate first abstract syntax trees corresponding to the programming languages respectively;
a generating unit 304, configured to compile first abstract syntax trees corresponding to each programming language by using a cross-platform framework compiler of each programming language, and generate core binary files corresponding to the programming language; the core binary file can be run in a virtual machine of a cross-platform framework.
Optionally, the cross-platform framework comprises a Flutter framework; the virtual machine comprises a Dart VM virtual machine; the core binary file includes a file suffixed dill.
Optionally, the cross-platform framework compiler includes a core compiler and a converter;
in the generating unit 304, the method includes:
a first compiling code generating subunit, configured to compile the first abstract syntax tree corresponding to each programming language with a core compiler of each programming language, and generate first compiling codes corresponding to the programming languages;
and the generating binary file subunit is used for converting the first compiling code of the programming language by utilizing a converter of each programming language respectively to generate a core binary file corresponding to the programming language.
Optionally, the parsing model comprises a front-end compiler;
in the analysis unit 303, the following are included:
and the analysis subunit is used for analyzing all the first segment codes corresponding to the programming languages based on the front-end compiler of each programming language and respectively generating first abstract syntax trees corresponding to the programming languages.
The embodiment of the disclosure provides a multi-language hybrid development solution based on a Flutter framework, which can support hybrid development of different programming languages, and can realize hybrid loading of Dart Kernel language by generating abstract syntax trees from code segments of different programming languages and converting a program binary file based on the abstract syntax trees.
The disclosed embodiment provides a third embodiment, that is, an electronic device, which is used for implementing a method for cross-platform multi-language development, and includes: at least one processor; and a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the one processor to cause the at least one processor to perform a method for implementing cross-platform multi-lingual development as described in the first embodiment.
The fourth embodiment provides a computer storage medium for implementing cross-platform multi-language development, where the computer storage medium stores computer-executable instructions that can execute the method for implementing cross-platform multi-language development as described in the first embodiment.
Referring now to FIG. 4, shown is a schematic diagram of an electronic device suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 4, the electronic device may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 401 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage means 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data necessary for the operation of the electronic apparatus are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
Generally, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 407 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 408 including, for example, tape, hard disk, etc.; and a communication device 409. The communication means 409 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. While fig. 4 illustrates an electronic device having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 409, or from the storage device 408, or from the ROM 402. The computer program performs the above-described functions defined in the methods of the embodiments of the present disclosure when executed by the processing device 401.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText transfer protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. 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 subcombination.
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 (10)

1. A method for realizing cross-platform multi-language development is characterized by comprising the following steps:
acquiring a first mixed code set; the first mixed code set comprises a plurality of first segment codes based on a plurality of programming languages, and each first segment code comprises code of one programming language;
analyzing the first mixed code set to obtain a first fragment code corresponding to each programming language;
analyzing all first segment codes corresponding to the programming languages based on a syntax analysis model of each programming language, and respectively generating first abstract syntax trees corresponding to the programming languages;
compiling a first abstract syntax tree corresponding to each programming language by using a cross-platform framework compiler of each programming language to generate a core binary file corresponding to the programming language; the core binary file can be run in a virtual machine of a cross-platform framework.
2. The method of claim 1, wherein the cross-platform framework comprises a Flutter framework; the virtual machine comprises a Dart VM virtual machine; the core binary file includes a file suffixed dill.
3. The method of claim 1, wherein the cross-platform framework compiler comprises a core compiler and a transformer;
the compiling the first abstract syntax trees corresponding to the programming languages by using the cross-platform framework compiler of each programming language respectively to generate the core binary files corresponding to the programming languages respectively comprises:
respectively compiling the first abstract syntax trees corresponding to the programming languages by using a core compiler of each programming language to respectively generate first coding codes corresponding to the programming languages;
and respectively converting the first compiling codes of the programming languages by using a converter of each programming language to generate a core binary file corresponding to the programming language.
4. The method of claim 1, wherein the parsing model comprises a front-end compiler;
the parsing module based on each programming language analyzes all first segment codes corresponding to the programming language to respectively generate a first abstract syntax tree corresponding to the programming language, and comprises:
and analyzing all first segment codes corresponding to the programming languages by a front-end compiler based on each programming language, and respectively generating first abstract syntax trees corresponding to the programming languages.
5. An apparatus for implementing cross-platform multi-language development, comprising:
an acquisition unit configured to acquire a first mixed code set; the first mixed code set comprises a plurality of first segment codes based on a plurality of programming languages, and each first segment code comprises code of one programming language;
a first segment code acquiring unit, configured to analyze the first mixed code set and acquire a first segment code corresponding to each programming language;
the analysis unit is used for analyzing all first segment codes corresponding to the programming languages based on a syntax analysis model of each programming language and respectively generating first abstract syntax trees corresponding to the programming languages;
the generating unit is used for compiling the first abstract syntax trees corresponding to the programming languages by utilizing a cross-platform framework compiler of each programming language and respectively generating core binary files corresponding to the programming languages; the core binary file can be run in a virtual machine of a cross-platform framework.
6. The apparatus of claim 5, wherein the cross-platform framework comprises a Flutter framework; the virtual machine comprises a Dart VM virtual machine; the core binary file includes a file suffixed dill.
7. The apparatus of claim 5, wherein the cross-platform framework compiler comprises a core compiler and a transformer;
in the generating unit, comprising:
a first compiling code generating subunit, configured to compile the first abstract syntax tree corresponding to each programming language with a core compiler of each programming language, and generate first compiling codes corresponding to the programming languages;
and the generating binary file subunit is used for converting the first compiling code of the programming language by utilizing a converter of each programming language respectively to generate a core binary file corresponding to the programming language.
8. The apparatus of claim 5, wherein the parsing model comprises a front-end compiler;
in the analysis unit, comprising:
and the analysis subunit is used for analyzing all the first segment codes corresponding to the programming languages based on the front-end compiler of each programming language and respectively generating first abstract syntax trees corresponding to the programming languages.
9. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the method according to any one of claims 1 to 4.
10. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out the method of any one of claims 1 to 4.
CN202010220564.1A 2020-03-25 2020-03-25 Method, device, medium and electronic equipment for realizing cross-platform multi-language development Pending CN111381817A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010220564.1A CN111381817A (en) 2020-03-25 2020-03-25 Method, device, medium and electronic equipment for realizing cross-platform multi-language development

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010220564.1A CN111381817A (en) 2020-03-25 2020-03-25 Method, device, medium and electronic equipment for realizing cross-platform multi-language development

Publications (1)

Publication Number Publication Date
CN111381817A true CN111381817A (en) 2020-07-07

Family

ID=71217439

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010220564.1A Pending CN111381817A (en) 2020-03-25 2020-03-25 Method, device, medium and electronic equipment for realizing cross-platform multi-language development

Country Status (1)

Country Link
CN (1) CN111381817A (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111966358A (en) * 2020-07-30 2020-11-20 上海泛微网络科技股份有限公司 Code packaging method and device, electronic equipment and computer readable storage medium
CN112732263A (en) * 2021-01-26 2021-04-30 长威信息科技发展股份有限公司 Cross-platform front-end framework technology fusion method and system
CN112882751A (en) * 2021-02-25 2021-06-01 曙光信息产业(北京)有限公司 CUDA program migration method, device, electronic equipment and storage medium
CN113722019A (en) * 2021-11-04 2021-11-30 海尔数字科技(青岛)有限公司 Display method, device and equipment of platform program
CN113918254A (en) * 2021-09-27 2022-01-11 腾讯科技(深圳)有限公司 Language text management method and device, storage medium and electronic equipment
CN113918214A (en) * 2021-09-24 2022-01-11 海宁奕斯伟集成电路设计有限公司 Program running method and device, electronic equipment and storage medium
CN113934407A (en) * 2021-12-08 2022-01-14 阿里云计算有限公司 Method, device, medium and computing equipment for calling interfaces among different language codes
WO2022033229A1 (en) * 2020-08-12 2022-02-17 武汉天喻信息产业股份有限公司 Software code compiling method and system
CN114296699A (en) * 2021-12-31 2022-04-08 北京和利时系统工程有限公司 An open industrial real-time control platform
CN114691141A (en) * 2020-12-29 2022-07-01 逸驾智能科技有限公司 Method, apparatus, device and medium for code compiling
CN114780100A (en) * 2022-04-08 2022-07-22 芯华章科技股份有限公司 Compiling method, electronic device, and storage medium
CN115729530A (en) * 2022-11-22 2023-03-03 壹沓科技(上海)有限公司 Cross-system logic statement generation method, device, storage medium and equipment
CN115981652A (en) * 2021-10-14 2023-04-18 华为技术有限公司 Language interoperability method, device, storage medium and program product
WO2024207878A1 (en) * 2023-04-07 2024-10-10 华为技术有限公司 Code search method, device and system
CN119045814A (en) * 2024-11-01 2024-11-29 深圳市魔数智擎人工智能有限公司 Feature-derived offline compiling cross-language SDK generation method
WO2025162153A1 (en) * 2024-02-04 2025-08-07 台州市艾赛康电子有限公司 Mixed language compilation method

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040194072A1 (en) * 2003-03-25 2004-09-30 Venter Barend H. Multi-language compilation
CN104182267A (en) * 2013-05-21 2014-12-03 中兴通讯股份有限公司 Compiling method, interpreting method, interpreting device and user equipment
CN108874396A (en) * 2018-05-31 2018-11-23 苏州蜗牛数字科技股份有限公司 The cross-compiler and Compilation Method of multi-platform multiple target language based on HLSL
CN108920133A (en) * 2018-06-14 2018-11-30 北京三快在线科技有限公司 Across Programming with Pascal Language method, apparatus, electronic equipment and storage medium
CN109254776A (en) * 2018-09-29 2019-01-22 深圳市雷赛控制技术有限公司 Multilingual code compiling method and compiler
CN109284145A (en) * 2018-08-28 2019-01-29 北京城市网邻信息技术有限公司 The generation of multilingual configuration file and methods of exhibiting and device, equipment and medium
CN110737431A (en) * 2019-09-18 2020-01-31 深圳市金证科技股份有限公司 Software development method, development platform, terminal device and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040194072A1 (en) * 2003-03-25 2004-09-30 Venter Barend H. Multi-language compilation
CN104182267A (en) * 2013-05-21 2014-12-03 中兴通讯股份有限公司 Compiling method, interpreting method, interpreting device and user equipment
CN108874396A (en) * 2018-05-31 2018-11-23 苏州蜗牛数字科技股份有限公司 The cross-compiler and Compilation Method of multi-platform multiple target language based on HLSL
CN108920133A (en) * 2018-06-14 2018-11-30 北京三快在线科技有限公司 Across Programming with Pascal Language method, apparatus, electronic equipment and storage medium
CN109284145A (en) * 2018-08-28 2019-01-29 北京城市网邻信息技术有限公司 The generation of multilingual configuration file and methods of exhibiting and device, equipment and medium
CN109254776A (en) * 2018-09-29 2019-01-22 深圳市雷赛控制技术有限公司 Multilingual code compiling method and compiler
CN110737431A (en) * 2019-09-18 2020-01-31 深圳市金证科技股份有限公司 Software development method, development platform, terminal device and storage medium

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111966358A (en) * 2020-07-30 2020-11-20 上海泛微网络科技股份有限公司 Code packaging method and device, electronic equipment and computer readable storage medium
CN111966358B (en) * 2020-07-30 2022-06-07 上海泛微网络科技股份有限公司 Code packaging method and device, electronic equipment and computer readable storage medium
WO2022033229A1 (en) * 2020-08-12 2022-02-17 武汉天喻信息产业股份有限公司 Software code compiling method and system
CN114691141A (en) * 2020-12-29 2022-07-01 逸驾智能科技有限公司 Method, apparatus, device and medium for code compiling
CN112732263A (en) * 2021-01-26 2021-04-30 长威信息科技发展股份有限公司 Cross-platform front-end framework technology fusion method and system
CN112882751A (en) * 2021-02-25 2021-06-01 曙光信息产业(北京)有限公司 CUDA program migration method, device, electronic equipment and storage medium
CN113918214A (en) * 2021-09-24 2022-01-11 海宁奕斯伟集成电路设计有限公司 Program running method and device, electronic equipment and storage medium
CN113918254A (en) * 2021-09-27 2022-01-11 腾讯科技(深圳)有限公司 Language text management method and device, storage medium and electronic equipment
CN115981652A (en) * 2021-10-14 2023-04-18 华为技术有限公司 Language interoperability method, device, storage medium and program product
CN115981652B (en) * 2021-10-14 2023-09-29 华为技术有限公司 Language interoperability methods, devices, storage media and program products
CN113722019A (en) * 2021-11-04 2021-11-30 海尔数字科技(青岛)有限公司 Display method, device and equipment of platform program
CN113934407A (en) * 2021-12-08 2022-01-14 阿里云计算有限公司 Method, device, medium and computing equipment for calling interfaces among different language codes
CN114296699A (en) * 2021-12-31 2022-04-08 北京和利时系统工程有限公司 An open industrial real-time control platform
CN114780100A (en) * 2022-04-08 2022-07-22 芯华章科技股份有限公司 Compiling method, electronic device, and storage medium
CN115729530A (en) * 2022-11-22 2023-03-03 壹沓科技(上海)有限公司 Cross-system logic statement generation method, device, storage medium and equipment
WO2024207878A1 (en) * 2023-04-07 2024-10-10 华为技术有限公司 Code search method, device and system
WO2025162153A1 (en) * 2024-02-04 2025-08-07 台州市艾赛康电子有限公司 Mixed language compilation method
CN119045814A (en) * 2024-11-01 2024-11-29 深圳市魔数智擎人工智能有限公司 Feature-derived offline compiling cross-language SDK generation method
CN119045814B (en) * 2024-11-01 2025-02-18 深圳市魔数智擎人工智能有限公司 A cross-language SDK generation method based on offline compilation and feature derivation

Similar Documents

Publication Publication Date Title
CN111381817A (en) Method, device, medium and electronic equipment for realizing cross-platform multi-language development
CN111158818B (en) Page rendering method and device
CN111813381A (en) Method, device, medium and electronic equipment for generating executable program in cross-platform mode
CN111338623B (en) Method, device, medium and electronic equipment for developing user interface
CN110442330B (en) List component conversion method and device, electronic equipment and storage medium
CN111240684B (en) Cutting method and device of JS codes, medium and electronic equipment
CN113031932A (en) Project development method and device, electronic equipment and storage medium
CN114035805A (en) Code conversion method, apparatus, medium, and device for pre-compiler
CN110941655B (en) A data format conversion method and device
CN111539200B (en) Method, device, medium and electronic equipment for generating rich text
CN110362317B (en) Code conversion method, device and storage medium
CN112395253B (en) Index file generation method, terminal device, electronic device and medium
CN111367516B (en) Application interface generation method and device and electronic equipment
US20100146492A1 (en) Translation of programming code
CN111581555B (en) Document loading method, device, equipment and storage medium
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN110851211A (en) Method, apparatus, electronic device, and medium for displaying application information
CN111338666A (en) Method, device, medium and electronic equipment for realizing application program upgrading
CN111857658A (en) A method, apparatus, medium and electronic device for rendering dynamic components
CN112416303B (en) Software development kit hot repair method and device and electronic equipment
CN114428615A (en) CSS compiling method, style updating method, device, medium and equipment
CN116360741A (en) Small program development method, system, device and storage medium
CN112162755B (en) Data processing method, device, medium and electronic equipment
CN113849242A (en) Method and device for generating, registering UI service package, and loading UI service
CN114968260B (en) Hybrid precompilation method, device, electronic device 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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200707