CN111813381A - Method, device, medium and electronic equipment for generating executable program in cross-platform mode - Google Patents

Method, device, medium and electronic equipment for generating executable program in cross-platform mode Download PDF

Info

Publication number
CN111813381A
CN111813381A CN202010573869.0A CN202010573869A CN111813381A CN 111813381 A CN111813381 A CN 111813381A CN 202010573869 A CN202010573869 A CN 202010573869A CN 111813381 A CN111813381 A CN 111813381A
Authority
CN
China
Prior art keywords
cross
code
framework
platform
platform framework
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
CN202010573869.0A
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 CN202010573869.0A priority Critical patent/CN111813381A/en
Publication of CN111813381A publication Critical patent/CN111813381A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/22Procedural
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis

Landscapes

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

Abstract

The present disclosure provides a method, apparatus, medium, and electronic device for generating a runnable program across platforms. The method comprises the following steps: under a cross-platform framework, acquiring a first description code; the first description code is code for defining preset processing logic based on a domain-specific language; analyzing the first description code based on a syntax analysis model, and acquiring a first abstract syntax tree corresponding to the first description code; compiling the first abstract syntax tree by using a cross-platform framework compiler to generate a core binary file; the core binary file can be run in a virtual machine of a cross-platform framework. The present disclosure avoids the complex hierarchical structure of development in the Dart language, and the continuous hierarchical indentation and nesting. The code is more optimized, making execution faster. And errors can be found in the process of compiling the abstract syntax tree, so that the type is safer. And the grammatical property of the domain-specific language effectively improves the logic readability of the code under the cross-platform framework.

Description

Method, device, medium and electronic equipment for generating executable program in cross-platform mode
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 generating a runnable program across platforms.
Background
The existing cross-platform development framework is widely applied by virtue of the advantages of cross-platform property, high fidelity, high performance and the like, provides abundant components and interfaces, and is convenient for developers to develop a set of codes and applicable to various platforms.
Taking the Flutter framework as an example, the Flutter framework is an open-source mobile application development framework, and the mobile application development framework developed based on the Flutter framework can run on an iOS platform or an 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. Before the AOT program runs, the source code file is directly compiled into the local machine code. The JIT scheme is a process that compiles class file bytecodes into local machine code at runtime.
However, when the Dart language is adopted for development under the Flutter framework, a component stacking mode is usually adopted, so that the development difficulty is high, the code readability is poor, and the maintenance is difficult.
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 generating a runnable program across platforms, 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 generating a runnable program across platforms, including:
under a cross-platform framework, acquiring a first description code; the first description code is code for defining preset processing logic based on a domain-specific language;
analyzing the first description code based on a syntax analysis model, and acquiring a first abstract syntax tree corresponding to the first description code;
compiling the first abstract syntax tree by using a cross-platform framework compiler to generate a core binary file; the core binary file can be run in a virtual machine of a cross-platform framework.
According to a second aspect, the present disclosure provides an apparatus for generating a runnable program across platforms, including:
the acquisition unit is used for acquiring a first description code under a cross-platform framework; the first description code is code for defining preset processing logic based on a domain-specific language;
the analysis unit is used for analyzing the first description code based on a syntax analysis model and acquiring a first abstract syntax tree corresponding to the first description code;
the generating unit is used for compiling the first abstract syntax tree by utilizing a cross-platform framework compiler to generate a core binary file; the core binary file can be run in a virtual machine of a cross-platform framework.
According to a third aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of generating a runnable program across platforms as claimed in any of the first aspect.
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 carry out a method of generating a runnable program across platforms as claimed in any of the first aspect.
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 generating a runnable program across platforms. The present disclosure provides a cross-platform framework, which employs a domain-specific language to define a preset processing logic under the cross-platform framework, thereby avoiding development difficulty caused by component accumulation and improving code readability. The domain-specific language definition preset processing logic is converted into an abstract syntax tree, so that the domain-specific language which cannot be compiled under a cross-platform framework is changed into a compilable abstract syntax tree, and the problem of compiling the domain-specific language is solved. Enabling domain-specific languages to work well with known libraries or frameworks. The complex hierarchical structure is avoided when Dart language is adopted for development, and continuous hierarchical indentation and nesting are avoided. The code is more optimized, making execution faster. And errors can be found in the process of compiling the abstract syntax tree, so that the type is safer. And the grammatical property of the domain-specific language effectively improves the logic readability of the code under the cross-platform framework.
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 shows a flow diagram of a method of cross-platform generation of a runnable program according to an embodiment of the disclosure;
FIG. 2 shows a schematic diagram of a method of cross-platform generation of a runnable program according to an embodiment of the disclosure;
figure 3 shows a DSL description fragment of a method of cross-platform generation of a runnable program according to an embodiment of the disclosure;
FIG. 4 illustrates a sub-tree of a first abstract syntax tree of a method of cross-platform generation of a runnable program according to an embodiment of the disclosure;
FIG. 5 illustrates a block diagram of elements of an apparatus for cross-platform generation of a runnable program according to an embodiment of the disclosure;
fig. 6 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.
A first embodiment provided by the present disclosure is an embodiment of a method for generating a runnable program across platforms.
The embodiments of the present disclosure will be described in detail with reference to fig. 1 to 4. Please refer to fig. 1 and fig. 2.
Step S101, under a cross-platform framework, a first description code 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 network front end 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 network front 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, and thus, other computer languages than the Dart language can be run in the Dart VM virtual machine. Such as a domain specific language.
The first description code is code defining preset processing logic based on a domain-specific language.
A Domain Specific Language (DSL) is a computer programming Language with limited expression for a Specific Domain. In the embodiment of the present disclosure, the DSL may adopt a micro-language (micro-language) that implements preset processing logic.
The syntax of the DSL comprises the configuration syntax of JavaScript extensible markup language (JSX for short) under front-end framework React-Like.
Under the front end frame reach-Like, reach is included. React is a JavaScript library used to build a user interface. React adopts a declaration paradigm, can easily describe applications, minimizes interactions with a Document Object Model (DOM) through simulation of the DOM, and can be well matched with a known library or framework. Using fact, some short, independent pieces of code, called components, can be combined into a complex UI interface.
The element is the smallest unit forming the application of React, the configuration syntax of JSX is used for declaring the element in React, and the React uses the configuration syntax of JSX to describe the user interface. React often uses the configuration syntax of JSX instead of the conventional JavaScript syntax. JSX is implemented inside JavaScript. The JSX is optimized after being compiled into JavaScript codes, so that the execution is faster. And errors can be found in the compiling process, so that the type is safer. The template writing by using JSX is simpler and quicker. JSX can make JavaScript and hypertext Markup Language (HTML for short) mixed in DSL, so that DSL is flexible and fast, and the structure of DOM can be clearly seen at a glance.
For example, JSX-like tags in DSL include: self-closing tags and open/close tags;
self-closing tags have no ending symbol, have no way to insert other tags or words inside, and only some properties of themselves can be defined in the first description code. When the tag has no sub-elements, a self-closing tag can be used, and the format characteristics are as follows:
<JSXElementName JSXAttributes opt/>;
opening/closing tags in the first description code for controlling the representation of the attributes, wherein the format characteristics are as follows: (xxxiesentname JSXAttributes opt >);
if the value of the attribute is within the quotation mark, then process as String type (String):
const element1=<h1 className="red">Hello,world!</h1>;
if the value of the attribute is in parenthesis, then treat as an avaScript expression:
const element2=<img src={user.avatarUrl}></img>。
for example, the element name of JSX can be an identifier, namespace, and member expression;
the JSX attributes include: a general attribute and an expand attribute; the value of an attribute may be indicated by a double quote ("string"), a single quote ("string"), or a brace ({ expression }); it should be noted that if the value of the attribute adopts single/double quotation marks, the corresponding quotation marks can not appear in the character string value;
child elements of JSX, including: string literal, subcomponent and expression;
string literal values (String attributes) include: a write string type or HTML format;
an expression comprising: expression values, calling methods, and type conversions.
Step S102, analyzing the first description code based on a syntax analysis model, and acquiring a first abstract syntax tree corresponding to the first description code.
The parsing model is written for the first description code. Under the Flutter framework, the parsing model is a front-end Compiler (CFE), and the first description code is converted into a first abstract syntax tree through the CFE.
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.
For example, the DSL description segment in the first description code, please refer to fig. 3;
DSL contains self-close tags (e.g., Container that does not contain sub-elements) and open/close tags (e.g., Router, BuilderWidget that contains sub-elements);
there are various types of nodes of AST, including from the basic types:
Figure BDA0002550610940000061
hasChildren: whether a child element is included;
Figure BDA0002550610940000062
name: tag name (such as Router);
Figure BDA0002550610940000063
attrs params: label parameters (such as initRouter, provider, etc);
Figure BDA0002550610940000064
children list: a list of tags containing sub-elements;
Figure BDA0002550610940000065
parent: a parent node of the AST node;
Figure BDA0002550610940000066
root: a root node of the AST tree;
referring to fig. 4, the nodes of the subtree of the first abstract syntax tree corresponding to the DSL description fragment include some special attributes:
the attribute Router includes:
Figure BDA0002550610940000067
initRouter: an initialized interface path;
Figure BDA0002550610940000068
provider: a routing component provider;
the attribute Repeat includes:
Figure BDA0002550610940000069
numTimes: the number of repetitions of the subassembly;
Figure BDA00025506109400000610
closure: generation mode of the subassembly.
And step S103, compiling the first abstract syntax tree by using a cross-platform framework compiler to generate a core binary file.
The Kernel Binary file (full name Kernel Binary in english) can 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). The first abstract syntax tree is converted into a corresponding IR-level proprietary language of Dart language by a core compiler and converter, generating a dill-suffixed file.
Optionally, the method further includes:
and step S104, calling the core binary file running in the cross-platform framework virtual machine through a preset platform application program.
The preset platform comprises an iOS platform or an Android platform. 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 cross-platform framework, and a domain-specific language is adopted to define preset processing logic under the cross-platform framework, so that development difficulty caused by component accumulation is avoided, and readability of codes is improved. The domain-specific language definition preset processing logic is converted into an abstract syntax tree, so that the domain-specific language which cannot be compiled under a cross-platform framework is changed into a compilable abstract syntax tree, and the problem of compiling the domain-specific language is solved. Enabling domain-specific languages to work well with known libraries or frameworks. The complex hierarchical structure is avoided when Dart language is adopted for development, and continuous hierarchical indentation and nesting are avoided. The code is more optimized, making execution faster. And errors can be found in the process of compiling the abstract syntax tree, so that the type is safer. And the grammatical property of the domain-specific language effectively improves the logic readability of the code under the cross-platform framework.
Corresponding to the first embodiment provided by the disclosure, the disclosure also provides a second embodiment, namely a device for generating a runnable program across platforms. 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. 5 illustrates an embodiment of an apparatus for cross-platform generation of a runnable program provided by the present disclosure. Fig. 5 is a block diagram of a unit of an apparatus for generating a runnable program across platforms according to an embodiment of the present disclosure.
Referring to fig. 5, the present disclosure provides an apparatus for generating a runnable program across platforms, including: acquisition section 501, analysis section 502, and generation section 503.
An obtaining unit 501, configured to obtain a first description code under a cross-platform framework; the first description code is code for defining preset processing logic based on a domain-specific language;
an analyzing unit 502, configured to analyze the first description code based on a syntax analysis model, and obtain a first abstract syntax tree corresponding to the first description code;
a generating unit 503, configured to compile the first abstract syntax tree by using a cross-platform framework compiler, and generate a core binary file; the core binary file can be run in a virtual machine of a cross-platform framework.
Optionally, the syntax of the domain-specific language includes configuration syntax of JSX under front-end framework React-Like.
Optionally, the apparatus further comprises:
and the running unit is used for calling the core binary file running in the cross-platform framework virtual machine through a preset platform application program.
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.
The embodiment of the disclosure provides a cross-platform framework, and a domain-specific language is adopted to define preset processing logic under the cross-platform framework, so that development difficulty caused by component accumulation is avoided, and readability of codes is improved. The domain-specific language definition preset processing logic is converted into an abstract syntax tree, so that the domain-specific language which cannot be compiled under a cross-platform framework is changed into a compilable abstract syntax tree, and the problem of compiling the domain-specific language is solved. Enabling domain-specific languages to work well with known libraries or frameworks. The complex hierarchical structure is avoided when Dart language is adopted for development, and continuous hierarchical indentation and nesting are avoided. The code is more optimized, making execution faster. And errors can be found in the process of compiling the abstract syntax tree, so that the type is safer. And the grammatical property of the domain-specific language effectively improves the logic readability of the code under the cross-platform framework.
The third embodiment of the present disclosure provides an electronic device, which is a method for generating an executable program across platforms, where the electronic device includes: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the one processor to cause the at least one processor to perform the method of generating a runnable program across platforms as described in the first embodiment.
The fourth embodiment provides a computer storage medium for generating an executable program across platforms, where the computer storage medium stores computer-executable instructions that can execute the method for generating an executable program across platforms as described in the first embodiment.
Referring now to FIG. 6, 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. 6 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. 6, the electronic device may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 601, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the electronic apparatus are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Generally, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. While fig. 5 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 means 609, or may be installed from the storage means 608, or may be installed from the ROM 602. The computer program, when executed by the processing device 601, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
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.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. 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 of generating a runnable program across platforms, comprising:
under a cross-platform framework, acquiring a first description code; the first description code is code for defining preset processing logic based on a domain-specific language;
analyzing the first description code based on a syntax analysis model, and acquiring a first abstract syntax tree corresponding to the first description code;
compiling the first abstract syntax tree by using a cross-platform framework compiler to generate a core binary file; the core binary file can be run in a virtual machine of a cross-platform framework.
2. The method of claim 1, wherein the syntax of the domain-specific language comprises configuration syntax of JSX under front-end framework React-Like.
3. The method of claim 1, further comprising:
and calling the core binary file running in the cross-platform framework virtual machine through a preset platform application program.
4. The method of any one of claims 1-3, 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.
5. An apparatus for generating a runnable program across platforms, comprising:
the acquisition unit is used for acquiring a first description code under a cross-platform framework; the first description code is code for defining preset processing logic based on a domain-specific language;
the analysis unit is used for analyzing the first description code based on a syntax analysis model and acquiring a first abstract syntax tree corresponding to the first description code;
the generating unit is used for compiling the first abstract syntax tree by utilizing a cross-platform framework compiler to generate a core binary file; the core binary file can be run in a virtual machine of a cross-platform framework.
6. The apparatus of claim 5, wherein the syntax of the domain-specific language comprises configuration syntax of JSX under front-end framework React-Like.
7. The apparatus of claim 5, further comprising:
and the running unit is used for calling the core binary file running in the cross-platform framework virtual machine through a preset platform application program.
8. The apparatus of any of claims 5-7, 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.
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.
CN202010573869.0A 2020-06-22 2020-06-22 Method, device, medium and electronic equipment for generating executable program in cross-platform mode Pending CN111813381A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010573869.0A CN111813381A (en) 2020-06-22 2020-06-22 Method, device, medium and electronic equipment for generating executable program in cross-platform mode

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010573869.0A CN111813381A (en) 2020-06-22 2020-06-22 Method, device, medium and electronic equipment for generating executable program in cross-platform mode

Publications (1)

Publication Number Publication Date
CN111813381A true CN111813381A (en) 2020-10-23

Family

ID=72845397

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010573869.0A Pending CN111813381A (en) 2020-06-22 2020-06-22 Method, device, medium and electronic equipment for generating executable program in cross-platform mode

Country Status (1)

Country Link
CN (1) CN111813381A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112231068A (en) * 2020-12-18 2021-01-15 浙江太美医疗科技股份有限公司 Custom logic method, system and readable medium using domain specific language
CN113031932A (en) * 2021-03-11 2021-06-25 腾讯科技(深圳)有限公司 Project development method and device, electronic equipment and storage medium
CN114706571A (en) * 2022-06-02 2022-07-05 杭州比智科技有限公司 DSL-based declarative visualization chart development method and system
CN115113850A (en) * 2021-03-18 2022-09-27 京东方科技集团股份有限公司 Cross-platform application construction and operation method, server, terminal and system
CN115857900A (en) * 2023-01-13 2023-03-28 安世亚太科技股份有限公司 Code automatic generation method and device, electronic equipment and storage medium
CN115981652A (en) * 2021-10-14 2023-04-18 华为技术有限公司 Language interoperation method, language interoperation device, storage medium and program product

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9459848B1 (en) * 2015-05-29 2016-10-04 International Business Machines Corporation Obtaining correct compile results by absorbing mismatches between data types representations
CN107111503A (en) * 2014-12-22 2017-08-29 华为技术有限公司 For by the compilation of source code of the first programming language be in the second programming language program code method
US20170249130A1 (en) * 2016-02-26 2017-08-31 Oracle International Corporation Method for static security enforcement of a dsl
CN107423106A (en) * 2017-07-07 2017-12-01 北京小米移动软件有限公司 The method and apparatus for supporting more frame grammars
CN108874396A (en) * 2018-05-31 2018-11-23 苏州蜗牛数字科技股份有限公司 The cross-compiler and Compilation Method of multi-platform multiple target language based on HLSL
CN110737589A (en) * 2019-09-10 2020-01-31 北京字节跳动网络技术有限公司 automatic point burying method, device, medium and electronic equipment
CN110825384A (en) * 2019-10-28 2020-02-21 国电南瑞科技股份有限公司 ST language compiling method, system and compiler based on LLVM
CN111309752A (en) * 2019-11-26 2020-06-19 上海金融期货信息技术有限公司 Service flow data processing oriented domain specific language assembly and operation method thereof

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107111503A (en) * 2014-12-22 2017-08-29 华为技术有限公司 For by the compilation of source code of the first programming language be in the second programming language program code method
US9459848B1 (en) * 2015-05-29 2016-10-04 International Business Machines Corporation Obtaining correct compile results by absorbing mismatches between data types representations
US20170249130A1 (en) * 2016-02-26 2017-08-31 Oracle International Corporation Method for static security enforcement of a dsl
CN107423106A (en) * 2017-07-07 2017-12-01 北京小米移动软件有限公司 The method and apparatus for supporting more frame grammars
CN108874396A (en) * 2018-05-31 2018-11-23 苏州蜗牛数字科技股份有限公司 The cross-compiler and Compilation Method of multi-platform multiple target language based on HLSL
CN110737589A (en) * 2019-09-10 2020-01-31 北京字节跳动网络技术有限公司 automatic point burying method, device, medium and electronic equipment
CN110825384A (en) * 2019-10-28 2020-02-21 国电南瑞科技股份有限公司 ST language compiling method, system and compiler based on LLVM
CN111309752A (en) * 2019-11-26 2020-06-19 上海金融期货信息技术有限公司 Service flow data processing oriented domain specific language assembly and operation method thereof

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112231068A (en) * 2020-12-18 2021-01-15 浙江太美医疗科技股份有限公司 Custom logic method, system and readable medium using domain specific language
CN112231068B (en) * 2020-12-18 2021-03-16 浙江太美医疗科技股份有限公司 Custom logic method, system and readable medium using domain specific language
CN113031932A (en) * 2021-03-11 2021-06-25 腾讯科技(深圳)有限公司 Project development method and device, electronic equipment and storage medium
CN113031932B (en) * 2021-03-11 2023-10-20 腾讯科技(深圳)有限公司 Project development method, apparatus, electronic device and storage medium
CN115113850A (en) * 2021-03-18 2022-09-27 京东方科技集团股份有限公司 Cross-platform application construction and operation method, server, terminal and system
CN115981652A (en) * 2021-10-14 2023-04-18 华为技术有限公司 Language interoperation method, language interoperation device, storage medium and program product
CN115981652B (en) * 2021-10-14 2023-09-29 华为技术有限公司 Language interoperation method, device, storage medium and program product
CN114706571A (en) * 2022-06-02 2022-07-05 杭州比智科技有限公司 DSL-based declarative visualization chart development method and system
CN115857900A (en) * 2023-01-13 2023-03-28 安世亚太科技股份有限公司 Code automatic generation method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US11409949B2 (en) Mobile device resource provisioning system and method
CN111813381A (en) Method, device, medium and electronic equipment for generating executable program in cross-platform mode
CN111158818B (en) Page rendering method and device
JP6629848B2 (en) Page processing for mobile applications
US9026903B1 (en) Abstract syntax tree interpreter for generating a valid HTML document
US9965259B2 (en) System for translating diverse programming languages
CN110442330B (en) List component conversion method and device, electronic equipment and storage medium
US20090313613A1 (en) Methods and Apparatus for Automatic Translation of a Computer Program Language Code
US8762963B2 (en) Translation of programming code
WO2019233293A1 (en) Method and apparatus for developing application program
CN110457144B (en) Method, device, medium and equipment for realizing front-end application
CN111381817A (en) Method, device, medium and electronic equipment for realizing cross-platform multi-language development
Biessek Flutter for Beginners: An introductory guide to building cross-platform mobile applications with Flutter and Dart 2
CN113031932B (en) Project development method, apparatus, electronic device and storage medium
CN111324833A (en) Page display method, device, electronic design and computer readable medium
CN111857658A (en) Method, device, medium and electronic equipment for rendering dynamic component
CN114153459A (en) Interface document generation method and device
US9875088B2 (en) Optimized compiling of a template function
CN113495730A (en) Resource package generation and analysis method and device
Miravet et al. Framework for the declarative implementation of native mobile applications
CN110941655A (en) Data format conversion method and device
CN117008918A (en) Domain-specific language processing method, device, medium and electronic equipment
EP3005087A1 (en) Declarative configuration elements
CN110362317B (en) Code conversion method, device and storage medium
Martinez et al. Migrating c/c++ software to mobile platforms in the adm context

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