WO2025194931A1 - Data processing method and apparatus, device, and storage medium - Google Patents
Data processing method and apparatus, device, and storage mediumInfo
- Publication number
- WO2025194931A1 WO2025194931A1 PCT/CN2024/142529 CN2024142529W WO2025194931A1 WO 2025194931 A1 WO2025194931 A1 WO 2025194931A1 CN 2024142529 W CN2024142529 W CN 2024142529W WO 2025194931 A1 WO2025194931 A1 WO 2025194931A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- information
- symbol information
- scope
- function
- virtual machine
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/42—Syntactic analysis
- G06F8/427—Parsing
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4488—Object-oriented
- G06F9/449—Object-oriented method invocation or resolution
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
Definitions
- the present application relates to the field of information technology, and in particular to a data processing method, apparatus, device, and storage medium.
- Dart in Flutter is compiled ahead of time (AOT), meaning it must be compiled into machine code before running. Therefore, Dart in Flutter cannot be directly parsed just in time (JIT). Furthermore, while native Dart supports JIT, its application scenarios are limited and cannot be used in Flutter. Furthermore, during execution, Dart must be compiled before running, which reduces execution efficiency.
- the present application provides a data processing method, apparatus, device, and storage medium for solving the technical problem in the prior art that Dart cannot be parsed when directly running Flutter, thereby reducing execution efficiency.
- the present application provides a data processing method, comprising:
- the virtual machine uses a target query strategy to call the symbol information from the target scope according to the scope entry identifier, and runs the called symbol information to complete the runtime parsing of the initial programming language.
- compiling the source code of the initial programming language by a compiler to obtain a compilation result resource includes:
- the compiler compiles the source code of the initial programming language using a single source code file as a unit, and stores compiler node information of the source code of the initial programming language in the custom domain-specific language structure to obtain the compilation result resource.
- the user-defined domain-specific language structure information includes syntax information of the source code file, and the syntax information includes package references, variables, functions, classes, and type aliases.
- loading and parsing the compilation result resource by a virtual machine to obtain symbol information in the compilation result resource includes:
- the symbol information is obtained and loaded according to the custom domain feature language structure information, wherein the symbol information is the accessible syntax information, and the symbol information includes mandatory symbol information and optional symbol information.
- the mandatory symbol information includes the import content in the package reference, and the optional symbol information includes the export content and part content in the package reference.
- calling the symbol information from the target scope by the virtual machine using a corresponding query strategy according to a scope entry identifier includes:
- the virtual machine determines a target call entry according to the scope entry identifier, and calls the symbol information from the target scope through the target call entry;
- the target call entry includes at least one of a class call entry, a mixin call entry, an extension call entry, a static call entry, an anonymous function call entry, an internal function call entry, and an original call entry.
- the symbol information called by the execution includes:
- the virtual machine obtains a set of various function execution processes in the symbol information, and sets a preset evaluation method to identify the execution process of the expression, statement, function and class corresponding to the symbol information.
- the setting of the preset evaluation method to identify the execution process of the expression, statement, function, and class corresponding to the symbol information includes:
- the method for evaluating the function corresponding to the symbolic information by the virtual machine is to use the target scope, the positional parameter list, and the named parameter icon as parameters, and sequentially execute different expressions or statements under the function;
- the method for evaluating the expression and the statement corresponding to the symbolic information by the virtual machine is to use the target scope as a parameter.
- the function execution process includes:
- the virtual machine constructs a new context scope according to the target call entry, and points the upper layer of the new context scope to the scope corresponding to the current source code file;
- the compiler includes an abstract syntax tree; and the initial programming language includes a pre-runtime compiled programming language.
- the present application provides a data processing device, comprising:
- a compilation module configured to compile the source code of the initial programming language through a compiler to obtain compilation result resources, wherein the compilation result resources include custom domain feature language structure information;
- a loading and parsing module configured to load and parse the compilation result resource through a virtual machine to obtain symbol information in the compilation result resource, and store the symbol information in a target scope;
- the running module is used to call the symbol information from the target scope by using the virtual machine according to the scope entry identifier and adopting a corresponding query strategy, and run the called symbol information to complete the runtime parsing of the initial programming language.
- the compiling module is specifically configured to:
- the compiler compiles the source code of the initial programming language using a single source code file as a unit, and stores compiler node information of the source code of the initial programming language in the custom domain-specific language structure to obtain the compilation result resource.
- the user-defined domain-specific language structure information includes syntax information of the source code file, and the syntax information includes package references, variables, functions, classes, and type aliases.
- the loading and parsing module is specifically used to:
- the symbol information is obtained and loaded according to the custom domain feature language structure information, wherein the symbol information is the accessible syntax information, and the symbol information includes mandatory symbol information and optional symbol information.
- the mandatory symbol information includes the import content in the package reference, and the optional symbol information includes the export content and part content in the package reference.
- the operation module is specifically used to:
- the target call entry includes at least one of a class call entry, a mixin call entry, an extension call entry, a static call entry, an anonymous function call entry, an internal function call entry, and an original call entry.
- the operation module is further used to:
- the compiler includes an abstract syntax tree; and the initial programming language includes a pre-runtime compiled programming language.
- the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
- the memory stores computer-executable instructions
- the processor executes the computer-executable instructions stored in the memory to implement any possible data processing method provided in the first aspect.
- the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement any possible data processing method provided in the first aspect.
- the present application provides a computer program product, comprising computer-executable instructions, which, when executed by a processor, are used to implement any possible data processing method provided in the first aspect.
- the present application provides a data processing method, apparatus, device and storage medium, which first compiles the source code of the initial programming language through a compiler to obtain a compilation result resource, wherein the compilation result resource includes a domain characteristic language of custom domain characteristic language structure information.
- the compilation result resource is then loaded and parsed by a virtual machine to obtain the symbolic information in the compilation result resource, and the symbolic information is stored in a target scope.
- the virtual machine uses a target query strategy to call the symbolic information from the target scope according to the scope entry identifier, and runs the called symbolic information to complete the runtime parsing of the initial programming language.
- the data processing method provided in the present application generates a domain characteristic language of custom domain characteristic language structure information after compiling the source code through a compiler, and uses a virtual machine to parse the domain characteristic language and run it, thereby realizing the function of runtime parsing of the initial programming language, and decoupling compilation from operation, effectively increasing the execution efficiency of runtime parsing of the initial programming language.
- FIG1 is a schematic diagram of an application scenario provided by an embodiment of the present application.
- FIG2 is a flow chart of a data processing method provided in an embodiment of the present application.
- FIG3 is a schematic diagram of DSL structure information provided in an embodiment of the present application.
- FIG4 is a schematic diagram of a scope hierarchy structure provided in an embodiment of the present application.
- FIG5 is a schematic diagram of a process for calling symbolic information provided by an embodiment of the present application.
- FIG6 is a schematic diagram of the execution process of a function in a virtual machine provided in an embodiment of the present application.
- FIG7 is a schematic structural diagram of a data processing device provided in an embodiment of the present application.
- FIG8 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
- Dart in Flutter runs AOT, meaning it must be compiled into machine code before running. Therefore, Dart in Flutter cannot be JIT-ed. Furthermore, while native Dart supports JIT, its application scenarios are limited and cannot be used in Flutter. Furthermore, Dart must be compiled before running, reducing execution efficiency.
- the present application provides a data processing method, apparatus, device and storage medium.
- the inventive concept of the data processing method provided by the present application is: the source code of the initial programming language is compiled by a compiler to generate a custom domain feature language, wherein the custom domain feature language has customized its structural information, which can restore the original grammatical characteristics to the greatest extent, and facilitate candidate operation and error log collection and analysis.
- the compilation result resources generated by the compiler are parsed and run by the virtual machine, and the compilation result resources include the custom domain feature language structural information, thereby achieving the effect of JIT operation of the initial programming language.
- the symbol information parsed from the compilation result resources is stored in the target scope.
- different query strategies can be used to call the symbol information from the target scope, which can quickly realize the search of each symbol information, thereby improving the execution efficiency and decoupling the compilation and operation.
- FIG1 is a schematic diagram of an application scenario provided by an embodiment of the present application.
- a Flutter toolkit is running on an electronic device 100 for developing a financial mobile application that can run on a mobile terminal 300. Since Dart in Flutter cannot be JIT-run, the electronic device 200 is configured to execute the data processing method provided by an embodiment of the present application.
- the source code is compiled by a compiler to generate a custom domain feature language, and a compilation result resource is obtained.
- the compilation result resource is parsed and run using a virtual machine, thereby realizing the function of runtime parsing of the initial programming language, and decoupling compilation from operation, effectively increasing the execution efficiency of runtime parsing of the initial programming language.
- a compiler and a virtual machine are running in the electronic device 200.
- the compiler can be, for example, an Abstract Syntax Tree (AST).
- AST Abstract Syntax Tree
- the electronic device 100 and the electronic device 200 can be, for example, smart phones, tablet computers, computers, servers, server clusters and other devices.
- the embodiment of the present application does not limit the device types of the electronic device 100 and the electronic device 200.
- the electronic device 100 and the electronic device 200 in Figure 1 are illustrated by taking computers as an example.
- the mobile terminal 300 can be, for example, a smart phone, tablet computer, smart watch or other wearable smart device, computer, laptop computer, or any other terminal that can support financial applications developed by Flutter.
- the embodiment of the present application does not limit the type of mobile terminal 300.
- the mobile terminal 300 in Figure 1 is illustrated by taking a smart phone as an example.
- the embodiment of the present application does not limit the specific content of the financial application. For example, it can be an application such as the U chat desktop terminal of a financial institution department.
- FIG2 is a flow chart of a data processing method provided in an embodiment of the present application. As shown in FIG2 , the data processing method provided in an embodiment of the present application includes:
- the compilation result resources include custom domain-specific language structure information.
- a compiler can be used to compile the source code of the initial programming language to generate custom domain-specific language (DSL) structure information, thus obtaining the compilation result resource.
- the custom domain-specific language structure information includes not only the grammatical information of the source code file, but also the custom structure information.
- the initial programming language can be a programming language compiled before execution, which can include the corresponding programming language for AOT execution.
- step S101 include:
- the compiler compiles the source code of the initial programming language in a single source code file as a unit, and stores the compiler node information of the source code of the initial programming language into the custom domain feature language structure information to obtain the compilation product, which is defined as the compilation result resource.
- package references may include import, export, part and other contents, which mainly include path, prefix, display name and hidden name.
- Variables may include name, type and value, where type and value are optional, and value is the value of the variable or expression.
- the type is Type, which has three types: function generic, named type and Record type.
- Functions may include positional parameters, named parameters and method bodies, etc.
- Method bodies may include block method bodies and expression method bodies (lambda expressions).
- the method body may include statements, such as if statements, switch statements, etc., and statements may be composed of multiple expressions, such as binary expressions, method call expressions, assignment expressions, lists, maps, etc.
- Meta classes may include classes, mixins, enumerations, extensions, etc., where classes may include member variables, member functions, constructors, static member variables, static member functions, etc.
- Generic aliases may include class type aliases, method aliases, etc.
- specific contents such as expressions and statements are related to the syntax of the source code file.
- the embodiments of the present application are not limited to this, and they can be represented using the same data interface.
- the DSL structure information such as expressions, statements, and functions can be as follows:
- the DSL structure information of the expression can be:
- a binary expression such as a+b, has a DSL structure that can:
- the DSL structure information of a statement is, for example:
- DSL structure information can be, for example:
- DSL structure information can be, for example:
- the symbolic information in the compiled result resources refers to the variables, functions, classes, and other information accessible during code execution, also known as accessible syntax information.
- the execution of Dar code involves the continuous loading, querying, creation, and updating of symbolic information.
- the virtual machine loads and parses the compilation result resources output by the compiler, for example, obtains the symbol information in the compilation result resources based on the custom domain feature language structure information, and stores the symbol information in the target scope.
- the symbol information loading process for each DSL may include: loading its own symbol information, loading exported symbol information, loading part symbol information, and loading imported symbol information based on import information.
- Symbol information includes both mandatory and optional symbol information.
- mandatory symbol information includes import content in package references, i.e., import information, because Dart source code implicitly imports dart:core during execution.
- Optional symbol information includes exported content in package references, i.e., export symbol information, as well as part content and part symbol information.
- the hierarchical structure of target scopes can be, for example, as shown in FIG4 .
- Setting a hierarchical structure of context target scopes for storing symbolic information during execution allows for relative independence of symbolic information between different scopes, thereby effectively controlling the scope of symbolic information.
- Each level of scope stores symbolic information such as classes, variables, and functions accessed within the current level, and can access symbolic information in the upper-level context scope by reference.
- S103 The virtual machine uses a target query strategy to call symbol information from the target scope according to the scope entry identifier, and runs the called symbol information to complete the runtime parsing of the initial programming language.
- the virtual machine determines the target call entry based on the pre-set scope entry identifier, and then enters the target call entry to query the corresponding symbolic information from the target scope, and then performs the function execution process on the queried symbolic information to complete the runtime parsing of the initial programming language.
- the scope entry identifier is used to identify the target call entry, and the target call entry may include but is not limited to at least one of a class call entry, a mixed mixin call entry, an extended call entry, a static call entry, an anonymous function call entry, an internal function call entry, and an original call entry.
- the original call entry identifies the entry of the code block inside the function.
- Different target call entries can effectively distinguish the symbol information query order in different scenarios, and can also improve the query speed. For example, for a static call entry, only static member variables and global variables need to be queried, and extended member information does not need to be queried. Therefore, setting the scope entry identifier can identify the level of the scope and can quickly perform corresponding symbol information queries based on different target call entries at runtime.
- Adopting a corresponding query strategy based on a scope entry means that different target call entries can be determined based on different scope entry identifiers, so that corresponding symbol information can be queried through the corresponding target call entry.
- the process of using different query strategies to query corresponding symbol information based on different scope entry identifiers can be shown in Figure 5. It should be noted that Figure 5 is only an illustrative example of some target call entries and does not limit them.
- the DSL structure information shows that executing Dart source code, or running calls to symbolic information, is a collection of various function execution processes, with the smallest execution unit being an expression. Furthermore, based on the characteristics of the DSL structure information, a pre-defined "Evaluate" method can be set to identify the execution process of the expression, statement, function, or class corresponding to the symbolic information.
- the execution process of the expression, statement, function, and class corresponding to the preset evaluation method identifier symbol information is set.
- Possible implementation methods include:
- the function execution process may be as shown in FIG6 , which is a schematic diagram of the function execution process in a virtual machine provided by an embodiment of the present application. As shown in FIG6 , the function execution process includes:
- a new context scope is constructed according to a target call entry through a virtual machine, and the upper layer of the new context scope is pointed to the scope corresponding to the current source code file.
- a new context scope is constructed based on different target call entries, and the upper layer of the newly constructed context scope points to the scope corresponding to the current source code file.
- the current source code file is the current Dart file.
- the current (this) variable is constructed and placed in the newly constructed context scope to access the attributes of the class during the function call.
- the class instance is placed in the new scope as the current variable, and then step S204 is executed.
- the execution method body includes the process of executing each expression and statement under the function.
- Calculating the value of the function parameters is to obtain the function parameters, which include positional parameters and named parameters, and storing the calculated function parameters in the new context scope, and finally executing the method body.
- the process of executing a method body is the process of executing various statements and expressions. If other functions are called, the process repeats. If a code block such as if or switch is executed, a new scope is created and its parent is pointed to the current scope to control different scopes. When the method body is executed, the entire function execution process ends, and the result of the function execution can be obtained.
- the add function in the aforementioned embodiment places the two parameters a and b passed in into the scope during execution.
- the values of a and b are queried in the scope and then the addition operation is performed to complete the execution of the add function.
- the data processing method provided in the embodiment of the present application first compiles the source code of the initial programming language through a compiler to obtain a compilation result resource, wherein the compilation result resource includes a domain characteristic language of custom domain characteristic language structure information.
- the compilation result resource is then loaded and parsed by a virtual machine to obtain the symbolic information in the compilation result resource, and the symbolic information is stored in the target scope.
- the virtual machine uses the target query strategy to call the symbolic information from the target scope according to the scope entry identifier, and runs the called symbolic information to complete the runtime parsing of the initial programming language.
- the data processing method provided in the present application compiles the source code through a compiler to generate a domain characteristic language of custom domain characteristic language structure information, and uses a virtual machine to parse the domain characteristic language and run it, thereby realizing the function of runtime parsing of the initial programming language, and decoupling compilation from operation, effectively increasing the execution efficiency of runtime parsing of the initial programming language.
- FIG7 is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application.
- the data processing device 400 provided in an embodiment of the present application includes:
- Compilation module 401 used to compile the source code of the initial programming language through a compiler to obtain compilation result resources, the compilation result resources including custom domain feature language structure information;
- the loading and parsing module 402 is used to load and parse the compilation result resource through the virtual machine to obtain the symbol information in the compilation result resource, and store the symbol information in the target scope;
- the running module 403 is used to call the symbol information from the target scope using the corresponding query strategy according to the scope entry identifier through the virtual machine, and run the called symbol information to complete the runtime analysis of the initial programming language.
- the compilation module 401 is specifically configured to:
- the compiler compiles the source code of the initial programming language using a single source code file as a unit, and stores compiler node information of the source code of the initial programming language in a custom structure to obtain a compilation result resource.
- the custom domain-specific language structure information includes syntax information of a source code file, where the syntax information includes package references, variables, functions, classes, and type aliases.
- the loading and parsing module 402 is specifically configured to:
- Symbol information is accessible syntax information.
- Symbol information includes mandatory symbol information and optional symbol information.
- mandatory symbol information includes import content in package references, and optional symbol information includes export content and part content in package references.
- the running module 403 is specifically configured to:
- the virtual machine determines the target call entry according to the scope entry identifier, and calls the symbol information from the target scope through the target call entry;
- the target call entry includes at least one of a class call entry, a mixin call entry, an extension call entry, a static call entry, an anonymous function call entry, an internal function call entry, and an original call entry.
- the running module 403 is further configured to:
- the virtual machine is used to obtain a collection of various function execution processes in the symbol information, and a preset evaluation method is set to identify the execution process of the expression, statement, function and class corresponding to the symbol information.
- the running module 403 is further configured to:
- the method name is set for the class corresponding to the symbol information through the virtual machine, and the execution process of the class in the symbol information is identified by the evaluation method of the function in the symbol information.
- the method name is used to identify the member function information in the called symbol information.
- the method of evaluating the function corresponding to the symbolic information through the virtual machine is to use the target scope, positional parameter list and named parameter icon as parameters, and execute different expressions or statements under the function in sequence;
- the evaluation method of the expression and statement corresponding to the symbolic information by the virtual machine is to use the target scope as a parameter.
- the running module 403 is further configured to:
- a new context scope is constructed through the virtual machine according to the target call entry, and the upper layer of the new context scope points to the scope corresponding to the current source code file;
- Executing the method body includes the process of executing each expression and statement under the function.
- the running module 403 is further configured to:
- the compiler includes an abstract syntax tree; and the initial programming language includes a pre-runtime compiled programming language.
- the data processing device provided in the embodiment of the present application can execute the corresponding steps of the data processing method in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here.
- FIG8 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
- the electronic device 500 may include: a processor 501 and a memory 502 communicatively connected to the processor 501 .
- the processor 501 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
- CPU central processing unit
- ASIC application specific integrated circuit
- the memory 502 may be independent or integrated with the processor 501 .
- the electronic device 500 may further include:
- Bus 503 is used to connect processor 501 and memory 502.
- the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus.
- ISA Industry Standard Architecture
- PCI Peripheral Component Interconnect
- EISA Extended Industry Standard Architecture
- Buses can be categorized as address buses, data buses, control buses, and so on, but this does not mean there is only one bus or only one type of bus.
- the present application also provides a computer-readable storage medium, which may include: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes.
- a computer-readable storage medium stores computer execution instructions, and the computer execution instructions are used for the methods in the above embodiments.
- the present application also provides a computer program product, including computer execution instructions, which implement the method in the above embodiment when executed by a processor.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
Description
本申请要求于2024年03月20日提交中国专利局、申请号为202410323218.4、申请名称为“数据处理方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application filed with the China Patent Office on March 20, 2024, with application number 202410323218.4 and application name “Data processing method, device, equipment and storage medium”, the entire contents of which are incorporated by reference into this application.
本申请涉及信息技术领域,尤其涉及一种数据处理方法、装置、设备及存储介质。The present application relates to the field of information technology, and in particular to a data processing method, apparatus, device, and storage medium.
Flutter中Dart是运行前编译(Ahead of Time,AOT)的,其要先编译成机器码,然后再运行。可见,Flutter中Dart无法直接运行时解析(Just In Time,JIT)。而且,原生Dart中虽然支持JIT,但是其应用场景有限,不能在Flutter中使用,并且其执行过程中需先把Dart进行编译然后再运行,从而降低了执行效率。Dart in Flutter is compiled ahead of time (AOT), meaning it must be compiled into machine code before running. Therefore, Dart in Flutter cannot be directly parsed just in time (JIT). Furthermore, while native Dart supports JIT, its application scenarios are limited and cannot be used in Flutter. Furthermore, during execution, Dart must be compiled before running, which reduces execution efficiency.
本申请提供一种数据处理方法、装置、设备及存储介质,用于解决现有技术中Dart无法在Flutter直接运行时解析从而降低了执行效率的技术问题。The present application provides a data processing method, apparatus, device, and storage medium for solving the technical problem in the prior art that Dart cannot be parsed when directly running Flutter, thereby reducing execution efficiency.
第一方面,本申请提供一种数据处理方法,包括:In a first aspect, the present application provides a data processing method, comprising:
通过编译器对初始编程语言的源码进行编译得到编译结果资源,所述编译结果资源包括自定义领域特征语言结构信息;Compiling the source code of the initial programming language through a compiler to obtain a compilation result resource, wherein the compilation result resource includes custom domain characteristic language structure information;
通过虚拟机加载并解析所述编译结果资源以获取所述编译结果资源中的符号信息,并将所述符号信息存储至目标作用域;Loading and parsing the compilation result resource through a virtual machine to obtain symbol information in the compilation result resource, and storing the symbol information in a target scope;
通过所述虚拟机根据作用域入口标识采用目标查询策略从所述目标作用域调用所述符号信息,并运行调用到的所述符号信息,完成对所述初始编程语言的运行时解析。The virtual machine uses a target query strategy to call the symbol information from the target scope according to the scope entry identifier, and runs the called symbol information to complete the runtime parsing of the initial programming language.
在一种可能的设计中,所述通过编译器对初始编程语言的源码进行编译得到编译结果资源,包括:In a possible design, compiling the source code of the initial programming language by a compiler to obtain a compilation result resource includes:
通过所述编译器以所述初始编程语言的源码的单个源码文件为单位进行编译,并将所述初始编程语言的源码的编译器节点信息存储至所述自定义领域特征语言结构中,得到所述编译结果资源。The compiler compiles the source code of the initial programming language using a single source code file as a unit, and stores compiler node information of the source code of the initial programming language in the custom domain-specific language structure to obtain the compilation result resource.
在一种可能的设计中,所述自定义领域特征语言结构信息包括所述源码文件的语法信息,所述语法信息包括包引用、变量、函数、类以及类型别名。In a possible design, the user-defined domain-specific language structure information includes syntax information of the source code file, and the syntax information includes package references, variables, functions, classes, and type aliases.
在一种可能的设计中,所述通过虚拟机加载并解析所述编译结果资源以获取所述编译结果资源中的符号信息,包括:In a possible design, loading and parsing the compilation result resource by a virtual machine to obtain symbol information in the compilation result resource includes:
根据所述自定义领域特征语言结构信息获取所述符号信息并加载所述符号信息,所述符号信息为可访问的所述语法信息,所述符号信息包括必选符号信息和可选符号信息,所述必选符号信息包括包引用中的import内容,所述可选符号信息包括所述包引用中的export内容和part内容。The symbol information is obtained and loaded according to the custom domain feature language structure information, wherein the symbol information is the accessible syntax information, and the symbol information includes mandatory symbol information and optional symbol information. The mandatory symbol information includes the import content in the package reference, and the optional symbol information includes the export content and part content in the package reference.
在一种可能的设计中,所述通过所述虚拟机根据作用域入口标识采用对应查询策略从所述目标作用域调用所述符号信息,包括:In one possible design, calling the symbol information from the target scope by the virtual machine using a corresponding query strategy according to a scope entry identifier includes:
所述虚拟机根据所述作用域入口标识确定目标调用入口,通过所述目标调用入口从所述目标作用域调用所述符号信息;The virtual machine determines a target call entry according to the scope entry identifier, and calls the symbol information from the target scope through the target call entry;
所述目标调用入口包括类调用入口、混合mixin调用入口、扩展调用入口、静态调用入口、匿名函数调用入口、内部函数调用入口以及原始调用入口中的至少一个。The target call entry includes at least one of a class call entry, a mixin call entry, an extension call entry, a static call entry, an anonymous function call entry, an internal function call entry, and an original call entry.
在一种可能的设计中,所述运行调用到的所述符号信息,包括:In a possible design, the symbol information called by the execution includes:
所述虚拟机获取所述符号信息中各种函数执行过程的集合,并设置预设评价方法标识所述符号信息对应的表达式、语句、函数以及类的执行过程。The virtual machine obtains a set of various function execution processes in the symbol information, and sets a preset evaluation method to identify the execution process of the expression, statement, function and class corresponding to the symbol information.
在一种可能的设计中,所述设置预设评价方法标识所述符号信息对应的表达式、语句、函数以及类的执行过程,包括:In one possible design, the setting of the preset evaluation method to identify the execution process of the expression, statement, function, and class corresponding to the symbol information includes:
通过所述虚拟机对所述符号信息对应的所述类设置方法名,并以所述符号信息中的所述函数的评价方法标识所述符号信息中的所述类的执行过程,所述方法名用于标识调用到的所述符号信息中的成员函数信息;Setting a method name for the class corresponding to the symbolic information by the virtual machine, and identifying an execution process of the class in the symbolic information with an evaluation method of the function in the symbolic information, wherein the method name is used to identify member function information in the symbolic information being called;
通过所述虚拟机对所述符号信息对应的所述函数的评价方法是以所述目标作用域、位置参数列表以及命名参数图标为参数,依次执行所述函数下的不同表达式或者语句;The method for evaluating the function corresponding to the symbolic information by the virtual machine is to use the target scope, the positional parameter list, and the named parameter icon as parameters, and sequentially execute different expressions or statements under the function;
通过所述虚拟机对所述符号信息对应的所述表达式和所述语句的评价方法是以所述目标作用域为参数。The method for evaluating the expression and the statement corresponding to the symbolic information by the virtual machine is to use the target scope as a parameter.
在一种可能的设计中,所述函数执行过程包括:In one possible design, the function execution process includes:
所述虚拟机根据所述目标调用入口构建新的上下文作用域,并将新的所述上下文作用域的上层指向当前所述源码文件对应的作用域;The virtual machine constructs a new context scope according to the target call entry, and points the upper layer of the new context scope to the scope corresponding to the current source code file;
获取函数形参并存储所述函数形参至新的所述上下文作用域,且执行方法体并获取所述函数执行过程的结果,所述执行方法体包括执行所述函数下的各表达式和语句的过程。Obtain function parameters and store the function parameters in the new context scope, execute the method body and obtain the result of the function execution process, wherein the execution method body includes the process of executing each expression and statement under the function.
在一种可能的设计中,若所述目标调用入口对应类函数调用,在所述获取函数形参并存储所述函数形参至新的所述上下文作用域之前,还包括:In a possible design, if the target call entry corresponds to a class function call, before obtaining function parameters and storing the function parameters in the new context scope, the method further includes:
生成当前变量并存储所述当前变量至新的所述上下文作用域。Generate current variables and store the current variables in the new context scope.
在一种可能的设计中,所述编译器包括抽象语法树;所述初始编程语言包括运行前编译的编程语言。In one possible design, the compiler includes an abstract syntax tree; and the initial programming language includes a pre-runtime compiled programming language.
第二方面,本申请提供一种数据处理装置,包括:In a second aspect, the present application provides a data processing device, comprising:
编译模块,用于通过编译器对初始编程语言的源码进行编译得到编译结果资源,所述编译结果资源包括自定义领域特征语言结构信息;A compilation module, configured to compile the source code of the initial programming language through a compiler to obtain compilation result resources, wherein the compilation result resources include custom domain feature language structure information;
加载与解析模块,用于通过虚拟机加载并解析所述编译结果资源以获取所述编译结果资源中的符号信息,并将所述符号信息存储至目标作用域;A loading and parsing module, configured to load and parse the compilation result resource through a virtual machine to obtain symbol information in the compilation result resource, and store the symbol information in a target scope;
运行模块,用于通过所述虚拟机根据作用域入口标识采用对应查询策略从所述目标作用域调用所述符号信息,并运行调用到的所述符号信息,完成对所述初始编程语言的运行时解析。The running module is used to call the symbol information from the target scope by using the virtual machine according to the scope entry identifier and adopting a corresponding query strategy, and run the called symbol information to complete the runtime parsing of the initial programming language.
在一种可能的设计中,所述编译模块,具体用于:In one possible design, the compiling module is specifically configured to:
通过所述编译器以所述初始编程语言的源码的单个源码文件为单位进行编译,并将所述初始编程语言的源码的编译器节点信息存储至所述自定义领域特征语言结构中,得到所述编译结果资源。The compiler compiles the source code of the initial programming language using a single source code file as a unit, and stores compiler node information of the source code of the initial programming language in the custom domain-specific language structure to obtain the compilation result resource.
在一种可能的设计中,所述自定义领域特征语言结构信息包括所述源码文件的语法信息,所述语法信息包括包引用、变量、函数、类以及类型别名。In a possible design, the user-defined domain-specific language structure information includes syntax information of the source code file, and the syntax information includes package references, variables, functions, classes, and type aliases.
在一种可能的设计中,所述加载与解析模块,具体用于:In one possible design, the loading and parsing module is specifically used to:
根据所述自定义领域特征语言结构信息获取所述符号信息并加载所述符号信息,所述符号信息为可访问的所述语法信息,所述符号信息包括必选符号信息和可选符号信息,所述必选符号信息包括包引用中的import内容,所述可选符号信息包括所述包引用中的export内容和part内容。The symbol information is obtained and loaded according to the custom domain feature language structure information, wherein the symbol information is the accessible syntax information, and the symbol information includes mandatory symbol information and optional symbol information. The mandatory symbol information includes the import content in the package reference, and the optional symbol information includes the export content and part content in the package reference.
在一种可能的设计中,所述运行模块,具体用于:In one possible design, the operation module is specifically used to:
通过所述虚拟机根据所述作用域入口标识确定目标调用入口,通过所述目标调用入口从所述目标作用域调用所述符号信息;Determining a target call entry according to the scope entry identifier by the virtual machine, and calling the symbol information from the target scope through the target call entry;
所述目标调用入口包括类调用入口、混合mixin调用入口、扩展调用入口、静态调用入口、匿名函数调用入口、内部函数调用入口以及原始调用入口中的至少一个。The target call entry includes at least one of a class call entry, a mixin call entry, an extension call entry, a static call entry, an anonymous function call entry, an internal function call entry, and an original call entry.
在一种可能的设计中,所述运行模块,还用于:In a possible design, the operation module is further used to:
通过所述虚拟机获取所述符号信息中各种函数执行过程的集合,并设置预设评价方法标识所述符号信息对应的表达式、语句、函数以及类的执行过程。A set of various function execution processes in the symbol information is obtained through the virtual machine, and a preset evaluation method is set to identify the execution process of the expression, statement, function and class corresponding to the symbol information.
在一种可能的设计中,所述运行模块,还用于:In a possible design, the operation module is further used to:
通过所述虚拟机对所述符号信息对应的所述类设置方法名,并以所述符号信息中的所述函数的评价方法标识所述符号信息中的所述类的执行过程,所述方法名用于标识调用到的所述符号信息中的成员函数信息;Setting a method name for the class corresponding to the symbolic information by the virtual machine, and identifying an execution process of the class in the symbolic information with an evaluation method of the function in the symbolic information, wherein the method name is used to identify member function information in the symbolic information being called;
通过所述虚拟机对所述符号信息对应的所述函数的评价方法是以所述目标作用域、位置参数列表以及命名参数图标为参数,依次执行所述函数下的不同表达式或者语句;The method for evaluating the function corresponding to the symbolic information by the virtual machine is to use the target scope, the positional parameter list, and the named parameter icon as parameters, and sequentially execute different expressions or statements under the function;
通过所述虚拟机对所述符号信息对应的所述表达式和所述语句的评价方法是以所述目标作用域为参数。The method for evaluating the expression and the statement corresponding to the symbolic information by the virtual machine is to use the target scope as a parameter.
在一种可能的设计中,所述运行模块,还用于:In a possible design, the operation module is further used to:
通过所述虚拟机根据所述目标调用入口构建新的上下文作用域,并将新的所述上下文作用域的上层指向当前所述源码文件对应的作用域;Constructing a new context scope according to the target call entry by the virtual machine, and pointing the upper layer of the new context scope to the scope corresponding to the current source code file;
获取函数形参并存储所述函数形参至新的所述上下文作用域,且执行方法体并获取所述函数执行过程的结果,所述执行方法体包括执行所述函数下的各表达式和语句的过程。Obtain function parameters and store the function parameters in the new context scope, execute the method body and obtain the result of the function execution process, wherein the execution method body includes the process of executing each expression and statement under the function.
在一种可能的设计中,所述运行模块,还用于:In a possible design, the operation module is further used to:
生成当前变量并存储所述当前变量至新的所述上下文作用域。Generate current variables and store the current variables in the new context scope.
在一种可能的设计中,所述编译器包括抽象语法树;所述初始编程语言包括运行前编译的编程语言。In one possible design, the compiler includes an abstract syntax tree; and the initial programming language includes a pre-runtime compiled programming language.
第三方面,本申请提供一种电子设备,包括:处理器,以及与所述处理器通信连接的存储器;In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
所述存储器存储计算机执行指令;The memory stores computer-executable instructions;
所述处理器执行所述存储器存储的计算机执行指令,以实现第一方面中所提供的任意一种可能的数据处理方法。The processor executes the computer-executable instructions stored in the memory to implement any possible data processing method provided in the first aspect.
第四方面,本申请提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,所述计算机执行指令被处理器执行时用于实现第一方面中所提供的任意一种可能的数据处理方法。In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement any possible data processing method provided in the first aspect.
第五方面,本申请提供一种计算机程序产品,包括计算机执行指令,该计算机执行指令被处理器执行时用于实现第一方面中所提供的任意一种可能的数据处理方法。In a fifth aspect, the present application provides a computer program product, comprising computer-executable instructions, which, when executed by a processor, are used to implement any possible data processing method provided in the first aspect.
本申请提供一种数据处理方法、装置、设备及存储介质,首先通过编译器对初始编程语言的源码进行编译得到编译结果资源,其中,编译结果资源包括自定义领域特征语言结构信息的领域特征语言。然后通过虚拟机加载并解析编译结果资源获取编译结果资源中的符号信息,并将符号信息存储至目标作用域,再通过虚拟机根据作用域入口标识采用目标查询策略从目标作用域调用符号信息,并运行调用到的符号信息,完成对初始编程语言的运行时解析。本申请提供的数据处理方法通过编译器将源码编译后生成自定义领域特征语言结构信息的领域特征语言,利用虚拟机解析领域特征语言并运行,从而实现了初始编程语言运行时解析的功能,并将编译与运行解耦,有效增加初始编程语言运行时解析的执行效率。The present application provides a data processing method, apparatus, device and storage medium, which first compiles the source code of the initial programming language through a compiler to obtain a compilation result resource, wherein the compilation result resource includes a domain characteristic language of custom domain characteristic language structure information. The compilation result resource is then loaded and parsed by a virtual machine to obtain the symbolic information in the compilation result resource, and the symbolic information is stored in a target scope. The virtual machine then uses a target query strategy to call the symbolic information from the target scope according to the scope entry identifier, and runs the called symbolic information to complete the runtime parsing of the initial programming language. The data processing method provided in the present application generates a domain characteristic language of custom domain characteristic language structure information after compiling the source code through a compiler, and uses a virtual machine to parse the domain characteristic language and run it, thereby realizing the function of runtime parsing of the initial programming language, and decoupling compilation from operation, effectively increasing the execution efficiency of runtime parsing of the initial programming language.
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
图1为本申请实施例提供的一种应用场景示意图;FIG1 is a schematic diagram of an application scenario provided by an embodiment of the present application;
图2为本申请实施例提供的一种数据处理方法的流程示意图;FIG2 is a flow chart of a data processing method provided in an embodiment of the present application;
图3为本申请实施例提供的一种DSL结构信息示意图;FIG3 is a schematic diagram of DSL structure information provided in an embodiment of the present application;
图4为本申请实施例提供的一种作用域层级结构示意图;FIG4 is a schematic diagram of a scope hierarchy structure provided in an embodiment of the present application;
图5为本申请实施例提供的一种调用符号信息的流程示意图;FIG5 is a schematic diagram of a process for calling symbolic information provided by an embodiment of the present application;
图6为本申请实施例提供的一种虚拟机中函数的执行过程示意图;FIG6 is a schematic diagram of the execution process of a function in a virtual machine provided in an embodiment of the present application;
图7为本申请实施例提供的一种数据处理装置的结构示意图;FIG7 is a schematic structural diagram of a data processing device provided in an embodiment of the present application;
图8为本申请实施例提供的一种电子设备的结构示意图。FIG8 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的方法和装置的例子。Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of methods and apparatus consistent with certain aspects of the present application, as detailed in the appended claims.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例例如能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the numbers used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
Flutter中Dart是AOT运行的,其要先编译成机器码,然后再运行。可见,Flutter中Dart无法JIT运行。而且,原生Dart中虽然支持JIT,但是其应用场景有限,不能在Flutter中使用,并且其执行过程中需先把Dart进行编译然后再运行,从而降低了执行效率。Dart in Flutter runs AOT, meaning it must be compiled into machine code before running. Therefore, Dart in Flutter cannot be JIT-ed. Furthermore, while native Dart supports JIT, its application scenarios are limited and cannot be used in Flutter. Furthermore, Dart must be compiled before running, reducing execution efficiency.
针对现有技术中存在的上述问题,本申请提供一种数据处理方法、装置、设备及存储介质。本申请提供的数据处理方法的发明构思在于:通过编译器将初始编程语言的源码进行编译生成自定义领域特征语言,其中自定义领域特征语言中自定义了其结构信息,可以最大还原原有的语法特点,便于候选运行以及错误日志收集与分析。进而基于Dart VM中支持JIT运行的特点,通过虚拟机解析并运行编译器生成的编译结果资源,编译结果资源包括自定义领域特征语言结构信息,从而实现初始编程语言JIT运行的效果。其中,在虚拟机中,通过目标作用域存储从编译结果资源中解析得到的符号信息,在运行时通过设置作用域入口标识可以采用不同查询策略从目标作用域中调用符号信息,可以快速实现各符号信息的查找,进而提高执行效率,并且将编译与运行得以解耦。In response to the above-mentioned problems existing in the prior art, the present application provides a data processing method, apparatus, device and storage medium. The inventive concept of the data processing method provided by the present application is: the source code of the initial programming language is compiled by a compiler to generate a custom domain feature language, wherein the custom domain feature language has customized its structural information, which can restore the original grammatical characteristics to the greatest extent, and facilitate candidate operation and error log collection and analysis. Furthermore, based on the feature of supporting JIT operation in Dart VM, the compilation result resources generated by the compiler are parsed and run by the virtual machine, and the compilation result resources include the custom domain feature language structural information, thereby achieving the effect of JIT operation of the initial programming language. Among them, in the virtual machine, the symbol information parsed from the compilation result resources is stored in the target scope. At runtime, by setting the scope entry identifier, different query strategies can be used to call the symbol information from the target scope, which can quickly realize the search of each symbol information, thereby improving the execution efficiency and decoupling the compilation and operation.
图1为本申请实施例提供的一种应用场景示意图,如图1所示,电子设备100上运行有Flutter工具包,用于开发可以运行于移动终端300的金融移动应用程序。由于Flutter中Dart无法JIT运行,故而,电子设备200被配置为可以执行本申请实施例提供的数据处理方法,首先通过编译器将源码编译后生成自定义领域特征语言,得到编译结果资源,进而利用虚拟机解析编译结果资源并运行,从而实现了初始编程语言运行时解析的功能,并将编译与运行解耦,有效增加初始编程语言运行时解析的执行效率。其中,电子设备200中运行有编译器与虚拟机。在一些实施例中,编译器可以例如抽象语法树(Abstract Syntax Tree,AST)。FIG1 is a schematic diagram of an application scenario provided by an embodiment of the present application. As shown in FIG1 , a Flutter toolkit is running on an electronic device 100 for developing a financial mobile application that can run on a mobile terminal 300. Since Dart in Flutter cannot be JIT-run, the electronic device 200 is configured to execute the data processing method provided by an embodiment of the present application. First, the source code is compiled by a compiler to generate a custom domain feature language, and a compilation result resource is obtained. Then, the compilation result resource is parsed and run using a virtual machine, thereby realizing the function of runtime parsing of the initial programming language, and decoupling compilation from operation, effectively increasing the execution efficiency of runtime parsing of the initial programming language. Among them, a compiler and a virtual machine are running in the electronic device 200. In some embodiments, the compiler can be, for example, an Abstract Syntax Tree (AST).
在一些实施例中,电子设备100和电子设备200可以例如智能手机、平板电脑、计算机、服务器、服务器集群等设备,本申请实施例对于电子设备100和电子设备200的设备类型不作限定,图1中的电子设备100和电子设备200以计算机为例示出。移动终端300可以例如智能手机、平板电脑、智能手表或其它可穿戴智能设备、计算机、笔记本电脑等可以支持Flutter开发的金融应用程序的任意终端,本申请实施例对于移动终端300类型不作限定,图1中移动终端300以智能手机为例示出。另外,本申请实施例对于金融应用程序的具体内容不作限定,例如可以是金融机构部门的U聊桌面端等应用。In some embodiments, the electronic device 100 and the electronic device 200 can be, for example, smart phones, tablet computers, computers, servers, server clusters and other devices. The embodiment of the present application does not limit the device types of the electronic device 100 and the electronic device 200. The electronic device 100 and the electronic device 200 in Figure 1 are illustrated by taking computers as an example. The mobile terminal 300 can be, for example, a smart phone, tablet computer, smart watch or other wearable smart device, computer, laptop computer, or any other terminal that can support financial applications developed by Flutter. The embodiment of the present application does not limit the type of mobile terminal 300. The mobile terminal 300 in Figure 1 is illustrated by taking a smart phone as an example. In addition, the embodiment of the present application does not limit the specific content of the financial application. For example, it can be an application such as the U chat desktop terminal of a financial institution department.
需要说明的是,上述应用场景仅仅是示意性的,本申请实施例提供的数据处理方法、装置、设备及存储介质包括但不仅限于上述应用场景。It should be noted that the above application scenarios are merely illustrative, and the data processing methods, devices, equipment, and storage media provided in the embodiments of the present application include but are not limited to the above application scenarios.
图2为本申请实施例提供的一种数据处理方法的流程示意图。如图2所示,本申请实施例提供的数据处理方法,包括:FIG2 is a flow chart of a data processing method provided in an embodiment of the present application. As shown in FIG2 , the data processing method provided in an embodiment of the present application includes:
S101:通过编译器对初始编程语言的源码进行编译得到编译结果资源。S101: Compiling the source code of the initial programming language by a compiler to obtain a compilation result resource.
其中,编译结果资源包括自定义领域特征语言结构信息。The compilation result resources include custom domain-specific language structure information.
例如使用编译器将初始编程语言的源码进行编译生成自定义领域特征语言(Domain Specific Language,DSL)结构信息,也即得到编译结果资源。其中,自定义领域特征语言结构信息中不仅包含了源码文件的语法信息,还包含了自定义的结构信息。初始编程语言可以为与行前编译的编程语言,即可以包括AOT运行的相应编程语言。For example, a compiler can be used to compile the source code of the initial programming language to generate custom domain-specific language (DSL) structure information, thus obtaining the compilation result resource. The custom domain-specific language structure information includes not only the grammatical information of the source code file, but also the custom structure information. The initial programming language can be a programming language compiled before execution, which can include the corresponding programming language for AOT execution.
自定义领域特征语言结构信息,比如函数类型中的isGetter和isSetter字段,可以标明其是否是get和set函数,用于区分其他函数,并可以将同名getter和setter函数作为一个变量使用。又比如函数体,可以包含两种函数体,一种为普通的方法体,一种为函数语法糖,表达式函数体。通过自定义领域特征语言结构信息能够最大还原原有的语法特点,便于后续的运行以及错误日志收集与分析。Customize domain-specific language structure information. For example, the isGetter and isSetter fields in a function type can indicate whether it is a getter or setter function, distinguishing it from other functions. Getter and setter functions with the same name can also be used as a variable. Another example is a function body, which can contain two types of function bodies: a standard method body and a function body that is a syntax sugar expression. Customizing domain-specific language structure information allows you to maximize the restoration of original syntax features, facilitating subsequent execution and error log collection and analysis.
在一种可能的设计中,步骤S101可能的实现方式包括:In one possible design, possible implementations of step S101 include:
通过编译器以初始编程语言的源码的单个源码文件为单位进行编译,并将初始编程语言的源码的编译器节点信息存储至自定义领域特征语言结构信息中,得到编译产物,将编译产物定义为编译结果资源。The compiler compiles the source code of the initial programming language in a single source code file as a unit, and stores the compiler node information of the source code of the initial programming language into the custom domain feature language structure information to obtain the compilation product, which is defined as the compilation result resource.
例如,可以采用但不局限于JSON的DSL形式描述单个源码文件中的语法信息,其中单个Dart编译出来的DSL结构信息如图3所示。For example, the syntax information in a single source code file can be described in the form of a DSL, but not limited to JSON. The DSL structure information compiled from a single Dart file is shown in FIG3 .
参照图3所示,依据Dart语言的语法特点,每个DSL中包含了当前Dart源码文件的语法信息,语法信息可以如包引用、变量、函数、类、类型别名等。其中虚线框表示可选,虚线表示可选的一对一或者一对多的关系。As shown in Figure 3, based on the syntax characteristics of the Dart language, each DSL contains the syntax information of the current Dart source code file, such as package references, variables, functions, classes, type aliases, etc. Dashed boxes indicate optional items, and dashed lines indicate optional one-to-one or one-to-many relationships.
在一些实施例中,包引用可以包含import、export、part等内容,其主要包含了路径、前缀、展示名称、隐藏名称。变量可以包含名称、类型和值,其中类型和值是可选的,值为变量的值或者表达式。类型为Type,其有函数泛型、命名类型、Record类型三种。函数可以包含位置参数、命名参数以及方法体等。方法体可以包含块方法体、表达式方法体(lambda表达式)。方法体中可以包含语句,例如if语句、switch语句等,而语句可以由多种表达式组成,例如二值表达式、方法调用表达式、赋值表达式、列表、Map等。Meta类可以包含类、混入mixin、枚举、扩展等,其中类中可以包含成员变量、成员函数、构造方法、静态成员变量、静态成员函数等。泛型别名可以包含类类型别名、方法别名等。In some embodiments, package references may include import, export, part and other contents, which mainly include path, prefix, display name and hidden name. Variables may include name, type and value, where type and value are optional, and value is the value of the variable or expression. The type is Type, which has three types: function generic, named type and Record type. Functions may include positional parameters, named parameters and method bodies, etc. Method bodies may include block method bodies and expression method bodies (lambda expressions). The method body may include statements, such as if statements, switch statements, etc., and statements may be composed of multiple expressions, such as binary expressions, method call expressions, assignment expressions, lists, maps, etc. Meta classes may include classes, mixins, enumerations, extensions, etc., where classes may include member variables, member functions, constructors, static member variables, static member functions, etc. Generic aliases may include class type aliases, method aliases, etc.
为了进一步的便于运行时的解析,还可以设置特定字符标识,比特&(XX)、@(XX)、^(XX)等用于标识变量/函数访问、Meta访问、成员变量访问等。To further facilitate runtime parsing, you can also set specific character identifiers, such as &(XX), @(XX), ^(XX), etc., to identify variable/function access, Meta access, member variable access, etc.
在一些实施例中,表达式(Expression)以及语句(Statement)等具体内容都是与源码文件的语法相关,本申请实施例对此不作限定,其可以采用相同的数据接口进行表示。例如,以JSON格式的DSL为例进行说明,表达式,语句,函数(Function)等DSL结构信息,可以如下所示:In some embodiments, specific contents such as expressions and statements are related to the syntax of the source code file. The embodiments of the present application are not limited to this, and they can be represented using the same data interface. For example, taking a DSL in JSON format as an example, the DSL structure information such as expressions, statements, and functions can be as follows:
表达式的DSL结构信息可以为:
The DSL structure information of the expression can be:
二值表达式,形如a+b,其DSL结构信息可以:
A binary expression, such as a+b, has a DSL structure that can:
语句的DSL结构信息例如为:
The DSL structure information of a statement is, for example:
if语句形如如下代码:
The if statement looks like the following code:
其DSL结构信息可以例如:
Its DSL structure information can be, for example:
函数形如如下的add函数:
The function is like the add function below:
其DSL结构信息可以例如:
Its DSL structure information can be, for example:
lambda表达式函数,形如add函数:int add(int a,int b)=>a+b;其DSL结构信息可以例如:
A lambda expression function, such as the add function: int add(int a, int b)=>a+b; its DSL structure information can be, for example:
S102:通过虚拟机加载并解析编译结果资源以获取编译结果资源中的符号信息,并将符号信息存储至目标作用域。S102: Loading and parsing the compilation result resource through the virtual machine to obtain symbol information in the compilation result resource, and storing the symbol information in the target scope.
编译结果资源中的符号信息是指代码执行过程中,可以访问的变量、函数、类等信息,也即可访问的语法信息。Dar代码的执行过程是不断的进行符号信息的加载、查询、创建、更新的过程。The symbolic information in the compiled result resources refers to the variables, functions, classes, and other information accessible during code execution, also known as accessible syntax information. The execution of Dar code involves the continuous loading, querying, creation, and updating of symbolic information.
虚拟机将编译器输出的编译结果资源进行加载与解析,例如根据自定义领域特征语言结构信息获取编译结果资源中的符号信息,并将符号信息存储在目标作用域(Scope)中。The virtual machine loads and parses the compilation result resources output by the compiler, for example, obtains the symbol information in the compilation result resources based on the custom domain feature language structure information, and stores the symbol information in the target scope.
在一些实施例中,针对每个DSL其符号信息加载流程可以包括:加载自身符号信息、加载export符号信息、加载part符号信息以及依据import信息加载引入的符号信息。其中,符号信息中包括必选符号信息和可选符号信息,例如,必选符号信息包括包引用中的import内容也即import信息,因为Dart源码在执行过程中,隐式的导入了dart:core。可选符号信息包括包引用中的export内容即export符号信息和part内容及part符号信息。In some embodiments, the symbol information loading process for each DSL may include: loading its own symbol information, loading exported symbol information, loading part symbol information, and loading imported symbol information based on import information. Symbol information includes both mandatory and optional symbol information. For example, mandatory symbol information includes import content in package references, i.e., import information, because Dart source code implicitly imports dart:core during execution. Optional symbol information includes exported content in package references, i.e., export symbol information, as well as part content and part symbol information.
在一些实施例中,目标作用域的层级结构可以例如图4所示,设置层级结构的上下文目标作用域用于存储运行过程中的符号信息,可以使得不同作用域间的符号信息相对独立,从而能够很好的控制符号信息的作用域。每一层Scope存储当前层级内访问的类、变量、函数等符号信息,并能通过引用的方式访问上层的上下文Scope中的符号信息。In some embodiments, the hierarchical structure of target scopes can be, for example, as shown in FIG4 . Setting a hierarchical structure of context target scopes for storing symbolic information during execution allows for relative independence of symbolic information between different scopes, thereby effectively controlling the scope of symbolic information. Each level of scope stores symbolic information such as classes, variables, and functions accessed within the current level, and can access symbolic information in the upper-level context scope by reference.
S103:通过虚拟机根据作用域入口标识采用目标查询策略从目标作用域调用符号信息,并运行调用到的符号信息,完成对初始编程语言的运行时解析。S103: The virtual machine uses a target query strategy to call symbol information from the target scope according to the scope entry identifier, and runs the called symbol information to complete the runtime parsing of the initial programming language.
对加载并解析获取到的符号信息,虚拟机根据提前设置的作用域入口标识确定目标调用入口,进而进入目标调用入口从目标作用域查询到对应的符号信息,再对查询到的符号信息进行函数执行过程,完成对初始编程语言的运行时解析。For the symbolic information loaded and parsed, the virtual machine determines the target call entry based on the pre-set scope entry identifier, and then enters the target call entry to query the corresponding symbolic information from the target scope, and then performs the function execution process on the queried symbolic information to complete the runtime parsing of the initial programming language.
在一些实施例中,作用域入口标识用于标识目标调用入口,目标调用入口可以包括但不限于类调用入口、混合mixin调用入口、扩展调用入口、静态调用入口、匿名函数调用入口、内部函数调用入口以及原始调用入口中的至少一个。其中,原始调用入口标识函数内部的代码块等入口。通过不同的目标调用入口可以有效的区分不通场景下的符号信息查询顺序,同时也可以提高查询速度,如静态调用入口,则只需要查询静态成员变量以及全局变量等即可,不用查询扩展成员信息。因此,设置作用域入口标识可以标识作用域的层级以及运行时可以依据不同目标调用入口快速地进行对应符号信息查询。In some embodiments, the scope entry identifier is used to identify the target call entry, and the target call entry may include but is not limited to at least one of a class call entry, a mixed mixin call entry, an extended call entry, a static call entry, an anonymous function call entry, an internal function call entry, and an original call entry. Among them, the original call entry identifies the entry of the code block inside the function. Different target call entries can effectively distinguish the symbol information query order in different scenarios, and can also improve the query speed. For example, for a static call entry, only static member variables and global variables need to be queried, and extended member information does not need to be queried. Therefore, setting the scope entry identifier can identify the level of the scope and can quickly perform corresponding symbol information queries based on different target call entries at runtime.
根据作用域入口采用对应查询策略则是指依据不同的作用域入口标识可以确定不同的目标调用入口,以通过对应的目标调用入口查询对应的符号信息。在一些实施例中,依据不同的作用域入口标识采用不同的查询策略查询对应符号信息的过程可如图5所示。需要说明的是,图5仅是对一些目标调用入口的示意性举例,并非对其限定说明。Adopting a corresponding query strategy based on a scope entry means that different target call entries can be determined based on different scope entry identifiers, so that corresponding symbol information can be queried through the corresponding target call entry. In some embodiments, the process of using different query strategies to query corresponding symbol information based on different scope entry identifiers can be shown in Figure 5. It should be noted that Figure 5 is only an illustrative example of some target call entries and does not limit them.
由图3所示的DSL结构信息可知,对Dart源码的执行也即运行调用到符号信息即是各种函数执行过程的集合,执行过程的最小单元为表达式。并且,依据DSL结构信息特点,还可以设置预设评价(Evaluate)方法标识符号信息对应的表达式、语句、函数以及类的执行过程。As shown in Figure 3, the DSL structure information shows that executing Dart source code, or running calls to symbolic information, is a collection of various function execution processes, with the smallest execution unit being an expression. Furthermore, based on the characteristics of the DSL structure information, a pre-defined "Evaluate" method can be set to identify the execution process of the expression, statement, function, or class corresponding to the symbolic information.
在一些实施例中,设置预设评价方法标识符号信息对应的表达式、语句、函数以及类的执行过程,可能的实现方式包括:In some embodiments, the execution process of the expression, statement, function, and class corresponding to the preset evaluation method identifier symbol information is set. Possible implementation methods include:
可以通过虚拟机对符号信息对应的类设置方法名,并以符号信息中的函数的评价方法标识符号信息中的类的执行过程,其中,方法名用于标识调用到的符号信息中的成员函数信息。类的评价方法的参数与函数的评价方法的参数相比,增加了方法名。因此,通过虚拟机对符号信息对应的函数的评价方法,则是以目标作用域、位置参数列表以及命名参数图标(Map)为参数,依次执行函数下的不同表达式或者语句。通过虚拟机对符号信息对应的表达式和语句的评价方法,则是以目标作用域为参数,从而可以依据其DSL结构信息执行并获取到相应的执行结果。The virtual machine can be used to set a method name for the class corresponding to the symbolic information, and use the evaluation method of the function in the symbolic information to identify the execution process of the class in the symbolic information, where the method name is used to identify the member function information in the symbolic information that is called. Compared with the parameters of the evaluation method of the function, the parameters of the class evaluation method have the method name added. Therefore, the evaluation method of the function corresponding to the symbolic information by the virtual machine takes the target scope, positional parameter list, and named parameter icon (Map) as parameters, and executes different expressions or statements under the function in sequence. The evaluation method of the expression and statement corresponding to the symbolic information by the virtual machine takes the target scope as a parameter, so that it can be executed according to its DSL structure information and obtain the corresponding execution results.
在一种可能的设计中,函数执行过程可以如图6所示,图6为本申请实施例提供的一种虚拟机中函数的执行过程示意图。如图6所示,函数的执行过程包括:In one possible design, the function execution process may be as shown in FIG6 , which is a schematic diagram of the function execution process in a virtual machine provided by an embodiment of the present application. As shown in FIG6 , the function execution process includes:
S201:通过虚拟机根据目标调用入口构建新的上下文作用域,并将新的上下文作用域的上层指向当前源码文件对应的作用域。S201: A new context scope is constructed according to a target call entry through a virtual machine, and the upper layer of the new context scope is pointed to the scope corresponding to the current source code file.
依据不同的目标调用入口构建全新的上下文作用域,并将新构建的上下文作用域的上层指向当前源码文件对应的作用域,当前源码文件即当前Dart文件。A new context scope is constructed based on different target call entries, and the upper layer of the newly constructed context scope points to the scope corresponding to the current source code file. The current source code file is the current Dart file.
S202:判断目标调用入口是否对应类函数调用。S202: Determine whether the target call entry corresponds to a class function call.
判断当前的目标调用入口是否对应类函数调用,若是,执行步骤S203,若否,执行步骤S204。Determine whether the current target call entry corresponds to a class function call. If so, execute step S203; if not, execute step S204.
S203:生成当前变量并存储当前变量至新的上下文作用域。S203: Generate current variables and store the current variables in a new context scope.
如果是类函数调用则构建当前(this)变量并将当前变量放到新构建的上下文作用域,用以在函数调用过程中访问类的属性。也就是,将类实例作为当前变量放到新的作用域中,进而执行步骤S204。If it is a class function call, the current (this) variable is constructed and placed in the newly constructed context scope to access the attributes of the class during the function call. In other words, the class instance is placed in the new scope as the current variable, and then step S204 is executed.
S204:获取函数形参并存储函数形参至新的上下文作用域,且执行方法体并获取函数执行过程的结果。S204: Obtain function parameters and store them in a new context scope, execute the method body and obtain the result of the function execution process.
其中,执行方法体包括执行函数下的各表达式和语句的过程。The execution method body includes the process of executing each expression and statement under the function.
计算函数形参的值也即获取函数形参,函数形参包括位置参数以及命名参数,并将计算到的函数形参存放到新的该上下文作用域,最后执行方法体。Calculating the value of the function parameters is to obtain the function parameters, which include positional parameters and named parameters, and storing the calculated function parameters in the new context scope, and finally executing the method body.
执行方法体的过程就是执行各式语句以及表达式的过程。其中若调用了其他函数,则会重复该流程;如果是执行的if、switch等代码块,则会创建下一个新的作用域,并将其上层指向当前作用域,用以控制不同的作用域。待方法体执行结束,则整个函数执行过程结束,并可获取到函数执行的结果。The process of executing a method body is the process of executing various statements and expressions. If other functions are called, the process repeats. If a code block such as if or switch is executed, a new scope is created and its parent is pointed to the current scope to control different scopes. When the method body is executed, the entire function execution process ends, and the result of the function execution can be obtained.
例如前述实施例中的add函数,则是在执行过程中通过传入的a和b两个参数,放到作用域中,同时在执行二值表达式时,在作用域中查询a和b的值然后执行相加的操作即可完成add函数的执行。For example, the add function in the aforementioned embodiment places the two parameters a and b passed in into the scope during execution. At the same time, when executing a binary expression, the values of a and b are queried in the scope and then the addition operation is performed to complete the execution of the add function.
至此,通过设计并实现全量的Dart中的表达式、语句、函数、类等的执行过程,即可完成Dart语言的JIT执行,也即完成初始编程语言的运行时解析。At this point, by designing and implementing the execution process of all Dart expressions, statements, functions, classes, etc., we can complete the JIT execution of the Dart language, that is, complete the runtime parsing of the initial programming language.
本申请实施例提供的数据处理方法,首先通过编译器对初始编程语言的源码进行编译得到编译结果资源,其中,编译结果资源包括自定义领域特征语言结构信息的领域特征语言。然后通过虚拟机加载并解析编译结果资源获取编译结果资源中的符号信息,并将符号信息存储至目标作用域,再通过虚拟机根据作用域入口标识采用目标查询策略从目标作用域调用符号信息,并运行调用到的符号信息,完成对初始编程语言的运行时解析。本申请提供的数据处理方法通过编译器将源码编译后生成自定义领域特征语言结构信息的领域特征语言,利用虚拟机解析领域特征语言并运行,从而实现了初始编程语言运行时解析的功能,并将编译与运行解耦,有效增加初始编程语言运行时解析的执行效率。The data processing method provided in the embodiment of the present application first compiles the source code of the initial programming language through a compiler to obtain a compilation result resource, wherein the compilation result resource includes a domain characteristic language of custom domain characteristic language structure information. The compilation result resource is then loaded and parsed by a virtual machine to obtain the symbolic information in the compilation result resource, and the symbolic information is stored in the target scope. The virtual machine then uses the target query strategy to call the symbolic information from the target scope according to the scope entry identifier, and runs the called symbolic information to complete the runtime parsing of the initial programming language. The data processing method provided in the present application compiles the source code through a compiler to generate a domain characteristic language of custom domain characteristic language structure information, and uses a virtual machine to parse the domain characteristic language and run it, thereby realizing the function of runtime parsing of the initial programming language, and decoupling compilation from operation, effectively increasing the execution efficiency of runtime parsing of the initial programming language.
图7为本申请实施例提供的一种数据处理装置的结构示意图,如图7所示,本申请实施例提供的数据处理装置400,包括:FIG7 is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. As shown in FIG7 , the data processing device 400 provided in an embodiment of the present application includes:
编译模块401,用于通过编译器对初始编程语言的源码进行编译得到编译结果资源,编译结果资源包括自定义领域特征语言结构信息;Compilation module 401, used to compile the source code of the initial programming language through a compiler to obtain compilation result resources, the compilation result resources including custom domain feature language structure information;
加载与解析模块402,用于通过虚拟机加载并解析编译结果资源以获取编译结果资源中的符号信息,并将符号信息存储至目标作用域;The loading and parsing module 402 is used to load and parse the compilation result resource through the virtual machine to obtain the symbol information in the compilation result resource, and store the symbol information in the target scope;
运行模块403,用于通过虚拟机根据作用域入口标识采用对应查询策略从目标作用域调用符号信息,并运行调用到的符号信息,完成对初始编程语言的运行时解析。The running module 403 is used to call the symbol information from the target scope using the corresponding query strategy according to the scope entry identifier through the virtual machine, and run the called symbol information to complete the runtime analysis of the initial programming language.
在一种可能的设计中,编译模块401,具体用于:In one possible design, the compilation module 401 is specifically configured to:
通过编译器以初始编程语言的源码的单个源码文件为单位进行编译,并将初始编程语言的源码的编译器节点信息存储至自定义结构中,得到编译结果资源。The compiler compiles the source code of the initial programming language using a single source code file as a unit, and stores compiler node information of the source code of the initial programming language in a custom structure to obtain a compilation result resource.
在一种可能的设计中,自定义领域特征语言结构信息包括源码文件的语法信息,语法信息包括包引用、变量、函数、类以及类型别名。In a possible design, the custom domain-specific language structure information includes syntax information of a source code file, where the syntax information includes package references, variables, functions, classes, and type aliases.
在一种可能的设计中,加载与解析模块402,具体用于:In one possible design, the loading and parsing module 402 is specifically configured to:
根据自定义领域特征语言结构信息获取符号信息并加载符号信息,符号信息为可访问的语法信息,符号信息包括必选符号信息和可选符号信息,必选符号信息包括包引用中的import内容,可选符号信息包括包引用中的export内容和part内容。Obtain and load symbol information based on custom domain feature language structure information. Symbol information is accessible syntax information. Symbol information includes mandatory symbol information and optional symbol information. Mandatory symbol information includes import content in package references, and optional symbol information includes export content and part content in package references.
在一种可能的设计中,运行模块403,具体用于:In one possible design, the running module 403 is specifically configured to:
通过虚拟机根据作用域入口标识确定目标调用入口,通过目标调用入口从目标作用域调用符号信息;The virtual machine determines the target call entry according to the scope entry identifier, and calls the symbol information from the target scope through the target call entry;
目标调用入口包括类调用入口、混合mixin调用入口、扩展调用入口、静态调用入口、匿名函数调用入口、内部函数调用入口以及原始调用入口中的至少一个。The target call entry includes at least one of a class call entry, a mixin call entry, an extension call entry, a static call entry, an anonymous function call entry, an internal function call entry, and an original call entry.
在一种可能的设计中,运行模块403,还用于:In one possible design, the running module 403 is further configured to:
通过虚拟机获取符号信息中各种函数执行过程的集合,并设置预设评价方法标识符号信息对应的表达式、语句、函数以及类的执行过程。The virtual machine is used to obtain a collection of various function execution processes in the symbol information, and a preset evaluation method is set to identify the execution process of the expression, statement, function and class corresponding to the symbol information.
在一种可能的设计中,运行模块403,还用于:In one possible design, the running module 403 is further configured to:
通过虚拟机对符号信息对应的类设置方法名,并以符号信息中的函数的评价方法标识符号信息中的类的执行过程,方法名用于标识调用到的符号信息中的成员函数信息;The method name is set for the class corresponding to the symbol information through the virtual machine, and the execution process of the class in the symbol information is identified by the evaluation method of the function in the symbol information. The method name is used to identify the member function information in the called symbol information.
通过虚拟机对符号信息对应的函数的评价方法是以目标作用域、位置参数列表以及命名参数图标为参数,依次执行函数下的不同表达式或者语句;The method of evaluating the function corresponding to the symbolic information through the virtual machine is to use the target scope, positional parameter list and named parameter icon as parameters, and execute different expressions or statements under the function in sequence;
通过虚拟机对符号信息对应的表达式和语句的评价方法是以目标作用域为参数。The evaluation method of the expression and statement corresponding to the symbolic information by the virtual machine is to use the target scope as a parameter.
在一种可能的设计中,运行模块403,还用于:In one possible design, the running module 403 is further configured to:
通过虚拟机根据目标调用入口构建新的上下文作用域,并将新的上下文作用域的上层指向当前源码文件对应的作用域;A new context scope is constructed through the virtual machine according to the target call entry, and the upper layer of the new context scope points to the scope corresponding to the current source code file;
获取函数形参并存储函数形参至新的上下文作用域,且执行方法体并获取函数执行过程的结果,执行方法体包括执行函数下的各表达式和语句的过程。Get the function parameters and store them in the new context scope, execute the method body and get the result of the function execution process. Executing the method body includes the process of executing each expression and statement under the function.
在一种可能的设计中,运行模块403,还用于:In one possible design, the running module 403 is further configured to:
生成当前变量并存储当前变量至新的上下文作用域。Generates the current variable and stores it in the new context scope.
在一种可能的设计中,编译器包括抽象语法树;初始编程语言包括运行前编译的编程语言。In one possible design, the compiler includes an abstract syntax tree; and the initial programming language includes a pre-runtime compiled programming language.
本申请实施例提供的数据处理装置,可以执行上述方法实施例中数据处理方法的相应步骤,其实现原理和技术效果类似,在此不再赘述。The data processing device provided in the embodiment of the present application can execute the corresponding steps of the data processing method in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here.
图8为本申请实施例提供的一种电子设备的结构示意图。如图8所示,该电子设备500可以包括:处理器501,以及与处理器501通信连接的存储器502。FIG8 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. As shown in FIG8 , the electronic device 500 may include: a processor 501 and a memory 502 communicatively connected to the processor 501 .
存储器502,用于存放程序。具体地,程序可以包括程序代码,程序代码包括计算机执行指令。The memory 502 is used to store programs. Specifically, the programs may include program codes, and the program codes include computer-executable instructions.
存储器502可能包含高速RAM存储器,也可能还包括非易失性存储器(NoN-volatile memory),例如至少一个磁盘存储器。Memory 502 may include high-speed RAM memory, and may also include non-volatile memory (NoN-volatile memory), such as at least one disk memory.
处理器501用于执行存储器502存储的计算机执行指令,以实现上述数据处理方法。The processor 501 is configured to execute computer-executable instructions stored in the memory 502 to implement the above-mentioned data processing method.
其中,处理器501可能是一个中央处理器(Central Processing Unit,简称为CPU),或者是特定集成电路(Application Specific Integrated Circuit,简称为ASIC),或者是被配置成实施本申请实施例的一个或多个集成电路。Among them, the processor 501 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
可选地,存储器502既可以是独立的,也可以跟处理器501集成在一起。Optionally, the memory 502 may be independent or integrated with the processor 501 .
当存储器502是独立于处理器501之外的器件时,电子设备500,还可以包括:When the memory 502 is a device independent of the processor 501, the electronic device 500 may further include:
总线503,用于连接处理器501以及存储器502。总线可以是工业标准体系结构(industry standard architecture,简称为ISA)总线、外部设备互连(peripheral component,PCI)总线或扩展工业标准体系结构(extended industry standard architecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等,但并不表示仅有一根总线或一种类型的总线。Bus 503 is used to connect processor 501 and memory 502. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, control buses, and so on, but this does not mean there is only one bus or only one type of bus.
可选的,在具体实现上,如果存储器502和处理器501集成在一块芯片上实现,则存储器502和处理器501可以通过内部接口完成通信。Optionally, in a specific implementation, if the memory 502 and the processor 501 are integrated on a chip, the memory 502 and the processor 501 can communicate through an internal interface.
本申请还提供了一种计算机可读存储介质,该计算机可读存储介质可以包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random AccessMemory)、磁盘或者光盘等各种可以存储程序代码的介质,具体的,该计算机可读存储介质中存储有计算机执行指令,计算机执行指令用于上述实施例中的方法。The present application also provides a computer-readable storage medium, which may include: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes. Specifically, the computer-readable storage medium stores computer execution instructions, and the computer execution instructions are used for the methods in the above embodiments.
本申请还提供了一种计算机程序产品,包括计算机执行指令,该计算机指令被处理器执行时实现上述实施例中的方法。The present application also provides a computer program product, including computer execution instructions, which implement the method in the above embodiment when executed by a processor.
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由权利要求书指出。Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of the present application and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered merely as exemplary, and the true scope and spirit of the present application are indicated by the claims.
应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本申请的范围仅由所附的权利要求书来限制。It should be understood that the present application is not limited to the exact structure described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims (14)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410323218.4A CN118151945A (en) | 2024-03-20 | 2024-03-20 | Data processing method, device, equipment and storage medium |
| CN202410323218.4 | 2024-03-20 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2025194931A1 true WO2025194931A1 (en) | 2025-09-25 |
Family
ID=91296452
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2024/142529 Pending WO2025194931A1 (en) | 2024-03-20 | 2024-12-25 | Data processing method and apparatus, device, and storage medium |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN118151945A (en) |
| WO (1) | WO2025194931A1 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118151945A (en) * | 2024-03-20 | 2024-06-07 | 中国银联股份有限公司 | Data processing method, device, equipment and storage medium |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20160246622A1 (en) * | 2015-02-23 | 2016-08-25 | Karlen Simonyan | Method and system for implementing invocation stubs for the application programming interfaces embedding with function overload resolution for dynamic computer programming languages |
| CN112364053A (en) * | 2020-11-25 | 2021-02-12 | 成都佳华物链云科技有限公司 | Search optimization method and device, electronic equipment and storage medium |
| CN114706586A (en) * | 2022-03-11 | 2022-07-05 | 北京字节跳动网络技术有限公司 | Code compiling method, code running method, code compiling device, code running device, computer equipment and storage medium |
| CN116501330A (en) * | 2023-04-23 | 2023-07-28 | 寂山智工(苏州)科技有限公司 | Text programming language compiling method based on decoupling architecture |
| CN117519715A (en) * | 2023-11-08 | 2024-02-06 | 北京陌陌信息技术有限公司 | A code compilation method, device and compiler |
| CN118151945A (en) * | 2024-03-20 | 2024-06-07 | 中国银联股份有限公司 | Data processing method, device, equipment and storage medium |
-
2024
- 2024-03-20 CN CN202410323218.4A patent/CN118151945A/en active Pending
- 2024-12-25 WO PCT/CN2024/142529 patent/WO2025194931A1/en active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20160246622A1 (en) * | 2015-02-23 | 2016-08-25 | Karlen Simonyan | Method and system for implementing invocation stubs for the application programming interfaces embedding with function overload resolution for dynamic computer programming languages |
| CN112364053A (en) * | 2020-11-25 | 2021-02-12 | 成都佳华物链云科技有限公司 | Search optimization method and device, electronic equipment and storage medium |
| CN114706586A (en) * | 2022-03-11 | 2022-07-05 | 北京字节跳动网络技术有限公司 | Code compiling method, code running method, code compiling device, code running device, computer equipment and storage medium |
| CN116501330A (en) * | 2023-04-23 | 2023-07-28 | 寂山智工(苏州)科技有限公司 | Text programming language compiling method based on decoupling architecture |
| CN117519715A (en) * | 2023-11-08 | 2024-02-06 | 北京陌陌信息技术有限公司 | A code compilation method, device and compiler |
| CN118151945A (en) * | 2024-03-20 | 2024-06-07 | 中国银联股份有限公司 | Data processing method, device, equipment and storage medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN118151945A (en) | 2024-06-07 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110162296B (en) | Method and device for generating application programming interface document and terminal equipment | |
| CN109976761B (en) | Software development kit generation method and device and terminal equipment | |
| CN110187931B (en) | Method and device for running small program | |
| CN109325195B (en) | Rendering method and system for browser, computer device and computer storage medium | |
| CN106547527B (en) | JavaScript file construction method and device | |
| US9043757B2 (en) | Identifying differences between source codes of different versions of a software when each source code is organized using incorporated files | |
| CN106648755B (en) | A method and device for dynamically loading dex in Android art environment | |
| CN111796865B (en) | Byte code file modification method, device, terminal equipment and medium | |
| CN109032572B (en) | Method for Java program method internal connection based on byte code | |
| WO2025194931A1 (en) | Data processing method and apparatus, device, and storage medium | |
| CN111596970B (en) | Method, device, equipment and storage medium for dynamic library delay loading | |
| CN114579452A (en) | Interface influence detection method and related equipment | |
| CN108170430B (en) | Interface display method and system | |
| CN110727429A (en) | Front-end page generation method, device and equipment | |
| CN113254470B (en) | A data modification method, device, computer equipment and storage medium | |
| CN113495723A (en) | Method and device for calling functional component and storage medium | |
| US20250045030A1 (en) | Method, apparatus and device for implementing dependency injection based on hilt | |
| CN112650502A (en) | Batch processing task processing method and device, computer equipment and storage medium | |
| CN111399842A (en) | Code compiling method and device | |
| CN103049306B (en) | Simulation of static membership and parameterized constructors on interface-based APIs | |
| CN110018831B (en) | Program processing method, program processing apparatus, and computer-readable storage medium | |
| CN110780864A (en) | Control method and device for class method replacement, storage medium and electronic equipment | |
| CN117850780A (en) | Front-end query page generation method, query method, electronic device and storage medium | |
| CN112068814B (en) | Method, device, system and medium for generating executable file | |
| CN116450134A (en) | Configurable front-end control verification controller generation method and system |