Runtime-based file execution method, device, equipment and medium
By parsing and executing logical flow description language files on MCU-level embedded devices and generating and executing abstract syntax trees, the problem of not being able to quickly execute logical flow description language files on MCU-level devices is solved, and rapid graphical programming and software improvement is achieved Quality effect.
Patent Information
- Application Number
- CN202411480666.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-10-23
AI Technical Summary
The prior art cannot quickly execute logical flow description language files on MCU-level embedded devices, resulting in high development thresholds, difficult debugging, and prone to resource leakage and deadlock.
By reading and parsing data from a logical stream description language file, an abstract syntax tree is generated, and the built-in library functions and hardware input information are called based on the abstract syntax tree for execution. The output results are output through hardware output drivers or data services, which are realized in open source The ability to execute logical flow description language files in the MCU-level low-performance hardware environment.
It realizes the ability to quickly graphically program on MCU-level embedded devices, lowers the development threshold, avoids resource leakage and deadlock problems, and improves the software quality.
Smart Images

Figure CN119002897B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a runtime-based file execution method, device, equipment and medium. Background Art
[0002] Existing MCU-level hardware embedded system software development mainly uses programming languages such as C / Assembly / Rust. Due to limited resources, high-level languages cannot be used for programming, resulting in a high development threshold and difficult debugging. At the same time, due to the memory and hardware management methods of C / Assembly languages, resource leaks and deadlocks are prone to occur, leading to software quality problems. Various interpreted languages cannot be directly run on MCU-level hardware due to the size and computing power requirements of the interpreter / real-time compiler.
[0003] The output of existing graphical programming software relies on the logic flow description language file of the high-level language runtime, and MCU-level embedded products do not have the ability to run logic flow description language files. Therefore, the existing technical solutions cannot provide fast graphical programming capabilities for MCU-level embedded devices under interpretive runtime. Summary of the invention
[0004] The present invention provides a runtime-based file execution method, apparatus, device and medium, which realizes the execution of logic flow description language files in a low-performance hardware environment at the MCU level of open source Hongmeng.
[0005] In a first aspect, an embodiment of the present invention provides a runtime-based file execution method, the method comprising:
[0006] Read parsed data from a logic flow description language file and generate an abstract syntax tree; the logic flow description language file includes syntax tree node information, and the syntax tree node information includes syntax tree node types and reference relationships between syntax tree nodes;
[0007] Call built-in library functions and hardware input information according to the abstract syntax tree to execute and obtain output results;
[0008] The output result is output through a hardware output driver or a data service.
[0009] In a second aspect, an embodiment of the present invention further provides a runtime-based file execution device, the device comprising:
[0010] A data parsing module, used to read parsed data from a logic flow description language file and generate an abstract syntax tree; the logic flow description language file contains syntax tree node information, and the syntax tree node information includes syntax tree node types and reference relationships between syntax tree nodes;
[0011] The data execution module is used to call the built-in library function and hardware input information according to the abstract syntax tree to execute and obtain the output result;
[0012] The data output module is used to output the output result through a hardware output driver or a data service.
[0013] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a runtime-based file execution method as described in any one of the embodiments of the present invention is implemented.
[0014] In a fourth aspect, an embodiment of the present invention further provides a storage medium storing computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to execute a runtime-based file execution method as described in any one of the embodiments of the present invention.
[0015] The technical solution of the embodiment of the present invention builds an abstract syntax tree by real-time parsing of the logic flow description language file, periodically executes the logic execution chain of the abstract syntax tree at a specific frequency, and outputs the output result, thereby realizing a runtime-based file execution method based on logic description files in a low-performance hardware environment at the MCU level of open source Hongmeng.
[0016] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 This is a flowchart of a runtime-based file execution method provided in Embodiment 1 of the present invention.
[0019] Figure 2 It is a schematic diagram of a logic execution chain based on an interpreted runtime provided in the first embodiment of the present invention.
[0020] Figure 3 It is a structural diagram of a runtime-based file execution device provided in Embodiment 2 of the present invention.
[0021] Figure 4It is a structural schematic diagram of an electronic device that implements the runtime-based file execution method of an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can 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 that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] Embodiment 1:
[0025] Figure 1 A flowchart of a runtime-based file execution method is provided for the first embodiment of the present invention. This embodiment is applicable to file execution. The method can be executed by a runtime-based file execution device. The runtime-based file execution device can be implemented in the form of hardware and / or software. The runtime-based file execution device can be configured in any electronic device with network communication and computing. Figure 1 As shown, the method includes:
[0026] S110, reading parsed data from a logic flow description language file, and generating an abstract syntax tree; the logic flow description language file includes syntax tree node information, and the syntax tree node information includes syntax tree node types and reference relationships between syntax tree nodes.
[0027] In this embodiment, the logic flow description language file is a file type used to describe the logic flow of a program. The logic flow description language file uses various symbols and keywords to represent different logical operations. The logic flow description language file contains syntax tree node information, and the syntax tree node information includes syntax tree node types and reference relationships between syntax tree nodes. The abstract syntax tree is a tree structure containing program logic.
[0028] It should be noted that the output of existing graphical programming software relies on the logic flow description language file when the high-level language is running. However, the MCU-level embedded system does not have the ability to run the logic flow description language file. In order to solve the problem that the MCU-level embedded system of open source Hongmeng does not have the ability to quickly perform graphical programming, the embodiment of the present invention realizes that the logic flow description language file can be executed in the low-performance hardware environment of the MCU level of open source Hongmeng, solving the defect that the MCU-level embedded system of open source Hongmeng does not have the ability to quickly perform graphical programming.
[0029] Specifically, the parsed data is read from the logic flow description language file and an abstract syntax tree is generated. First, various syntax elements such as keywords, variable names, operators, brackets, etc. are identified from the logic flow description language file. According to the syntax rules of the logic flow description language, the syntax elements and syntax structures are combined into the structure of the abstract syntax tree. Each node in the abstract syntax tree represents a syntax element or a logical unit, and the reference relationship between the syntax tree nodes represents the logical structure and hierarchy of the program.
[0030] It should be noted that the generated abstract syntax tree is stored in the abstract syntax tree cluster buffer at runtime. When executing a file, the abstract syntax tree is read from the abstract syntax tree cluster buffer to perform file execution operations. The abstract syntax tree cluster buffer is responsible for reading data in a specific format from the logical syntax description file of the abstract syntax tree and verifying the format according to the template, and then generating the corresponding logical syntax tree cluster in the memory to be queried by the executor at runtime.
[0031] In addition, it should be noted that the event of reading the logical syntax description file is triggered by the MCU actively calling the instruction after starting or downloading a new file. A failed read will trigger a delay and try to read again after the delay expires.
[0032] S120, calling the built-in library function and the hardware input information according to the abstract syntax tree to execute and obtain an output result.
[0033] In this embodiment, each node in the abstract syntax tree represents a syntax element or a logical unit, and the reference relationship between the syntax tree nodes represents the logical structure and hierarchy of the program. Each node in the abstract syntax tree represents a library function in the built-in library, and multiple parallel logic flows constitute the abstract syntax tree. Hardware input information is dynamic data input by external hardware devices, which can be data collected by sensors or information entered by users through keyboards and mice.
[0034] Specifically, the precompiled built-in library functions and hardware input information are called according to the information of the abstract syntax tree to perform corresponding operations. As a structured representation of program logic, the abstract syntax tree provides a clear path guide for execution. The program will accurately trigger the corresponding function call according to the information of the abstract syntax tree. The built-in library functions are pre-set functions that cover various common functions, such as mathematical operations, string processing, file operations, etc. By passing appropriate parameters to these functions, the program can complete specific functions and tasks.
[0035] In addition, the program receives and processes hardware input information in real time, combining it with calls to built-in library functions. For example, numerical calculations are performed based on sensor input data, or specific functions are called to perform corresponding operations based on user instructions.
[0036] As an optional but non-limiting implementation method, calling a built-in library function and hardware input information according to the abstract syntax tree to execute and obtain an output result includes the following steps:
[0037] Traverse each syntax tree node in the abstract syntax tree to obtain syntax tree node information;
[0038] The built-in library function is called according to the syntax tree node information, and the corresponding operation is performed in the candidate memory based on the hardware input information and the built-in library function to obtain the output result.
[0039] In this embodiment, the output result represents the result obtained by calling the built-in library function in combination with the hardware input information, including a sequence set during the execution process.
[0040] Specifically, each syntax tree node in the abstract syntax tree can be traversed recursively or iteratively, and each syntax tree node in the abstract syntax tree can be accessed to obtain syntax tree node information, which includes the syntax tree node type. According to the syntax tree node type, the precompiled built-in library function is called to perform corresponding operations, and the corresponding operations are performed according to the hardware input information to obtain the output results. For example, if the syntax tree node type is a variable declaration, the create new variable library function is called to create a new variable in the running environment. If the syntax tree node is an arithmetic expression, the expression calculation function is called to calculate the value of the expression.
[0041] Specifically, the execution process of the abstract syntax tree also includes execution node operations, environment management operations, error handling operations, and control flow structure processing operations.
[0042] The execution node operation is to perform the operation corresponding to the type of the syntax tree node according to the type of the syntax tree node, such as calculating the value of an expression, executing a statement, calling a function, processing control flow structures (such as loops and conditional statements), etc.
[0043] The environment management operation is to manage an environment (or context) during the execution of the abstract syntax tree to store variable values and other program states. When the execution engine encounters a variable declaration or assignment statement, the variable value in the environment is updated. When the execution engine needs to calculate the value of an expression, the current value of the variable is obtained from the environment.
[0044] The error handling operation is that when the execution engine encounters an error during the execution of the abstract syntax tree, such as type mismatch, undefined variables or syntax errors, the execution engine can identify the error and write it into the state machine as a special output result.
[0045] The control flow structure processing operation enables the execution engine to process control flow structures, such as loops and conditional statements, track the current control flow path, and execute the corresponding branch according to the result of the conditional statement. For the scenario of logical loop connection (1-2-3-1 loop), the executor will distribute each loop to different preset execution cycles to calculate in sequence, that is, the output result of the current preset execution cycle is used as the input information of the loop of the next preset execution cycle.
[0046] As an optional but non-limiting implementation method, each syntax tree node in the abstract syntax tree is traversed to obtain syntax tree node information, including:
[0047] Allocate candidate memory in memory and create reference count or memory pool or smart pointer reference count or resource list in the candidate memory.
[0048] In this embodiment, the candidate memory represents the memory space occupied by variables or reference objects during program execution.
[0049] Creating a reference count in the candidate memory means creating a counter for each allocated memory block to record the number of pointers pointing to this memory block. When a new pointer points to a memory block, the reference count increases; when a pointer no longer points to a memory block, the reference count decreases. The advantage of reference counting is that it can quickly determine whether a memory block can be released, avoiding unnecessary memory allocation and release operations.
[0050] Creating a memory pool in the candidate memory means dividing the allocated memory into multiple fixed-size memory blocks and organizing these memory blocks into a pool. When the program needs to use memory, it obtains a memory block from the memory pool; when the program no longer needs the memory, it returns the memory block to the memory pool. The advantage of the memory pool is that it can reduce the overhead of memory allocation and release and improve the performance of the program.
[0051] Creating a smart pointer reference count in the candidate memory means using smart pointers to manage the allocated memory. Smart pointers manage the life cycle of the memory block they point to through reference counting. When a smart pointer is created, the reference count of the memory block it points to is increased; when a smart pointer is destroyed, the reference count of the memory block it points to is decreased.
[0052] Creating a resource list in candidate memory means adding the allocated memory block to the resource list so that the program can track and manage these resources. The resource list can include information such as the address, size, and usage status of the memory block. When the program no longer needs a memory block, it can delete the memory block from the resource list and release the candidate memory. The advantage of the resource list is that it can easily manage all resources in the program and avoid resource leaks and duplicate allocation problems.
[0053] Therefore, candidate memory can be allocated for the process of the executor traversing the abstract syntax tree and calling the built-in library function in the sandbox mode, and a reference count or memory pool or a smart pointer reference count or resource list can be created in the candidate memory.
[0054] As an optional but non-limiting implementation method, calling built-in library functions and hardware input information according to the abstract syntax tree to execute and obtain output results also includes:
[0055] In the candidate memory, the address bit data corresponding to the identification handle in the state machine is updated according to the output result, and the identification handle is an identifier for identifying and distinguishing different output results.
[0056] In this embodiment, the state machine can track different states and data of the program through various identification handles, and the identification handles are used to indicate the changed state or data. The output result generated by executing the operation indicates that a specific operation has been completed. The program may update the address bit data corresponding to the identification handle in the state machine to reflect the completion status of this operation. It may modify a specific bit flag or update the value stored at a specific address.
[0057] By updating the address bit data corresponding to the identification handle in the state machine according to the output results, the program can reflect the running status of the program in real time and provide an accurate basis for subsequent decisions and operations.
[0058] As an optional but non-limiting implementation method, calling built-in library functions and hardware input information according to the abstract syntax tree to execute and obtain output results also includes:
[0059] If the reference count value in the candidate memory is 0, the memory pool demand is 0, the smart pointer reference count is 0, or the resource list is 0, the candidate memory is released for garbage collection.
[0060] In this embodiment, the reference count is used for dynamically allocated candidate memory, and when the reference count is reduced to 0, the candidate memory is automatically released.
[0061] The memory pool can pre-allocate and manage candidate memory. When candidate memory is needed, it is requested from the memory pool. If the memory pool demand is 0, the candidate memory is returned to the memory pool to indirectly release the candidate memory.
[0062] The behavior of the smart pointer is simulated through a structure or function. If the reference count of the smart pointer is reduced to 0, the candidate memory pointed to by the smart pointer is automatically released.
[0063] In addition, it can also be simulated through structures and destructors. When resources are no longer needed, the resource list is 0, and the candidate memory is automatically released through the "destructor" function.
[0064] S130: Output the output result through a hardware output driver or a data service.
[0065] In this embodiment, the executor periodically outputs the output data in the state machine through the hardware output driver or communication service, ensuring that the state machine of the executor can maintain information interaction and synchronization with the hardware input and output driver and data service to meet the accuracy and real-time requirements of the cycle.
[0066] As an optional but non-limiting implementation, the method further includes:
[0067] If a logical execution chain cannot be completed within the preset execution cycle, the fuse mechanism is triggered. The execution order of the logical execution chain is reading the abstract syntax tree, executing the abstract syntax tree, updating the state machine and releasing the candidate memory. The fuse mechanism indicates that the execution process of the logical execution chain is interrupted according to the interrupt instruction and the candidate memory is released for garbage collection.
[0068] In this embodiment, the preset execution cycle is the time to execute a logic execution chain, and the execution process of the logic execution chain is to read the abstract syntax tree from the abstract syntax tree cache, execute the abstract syntax tree, update the state machine, and release the candidate memory. The fuse mechanism is used to release the candidate memory to ensure the real-time execution of the logic execution chain within the preset execution cycle.
[0069] See also Figure 2This is a schematic diagram of the logic execution chain based on the interpreted runtime. The execution process of the logic execution chain is to read the abstract syntax tree from the abstract syntax tree cache, execute the abstract syntax tree, update the state machine, and release the candidate memory for garbage collection.
[0070] The principle of the fuse mechanism mainly includes a running timer and a high-priority interrupt instruction. When the abstract syntax tree is read, the timer starts. When the timer reaches the preset execution cycle, the interrupt instruction is triggered immediately. The output result is first updated to the state machine, and then garbage collection operations such as stack cleanup and candidate memory release are performed to ensure the real-time performance of the preset execution cycle.
[0071] Specifically, the logical execution chain that fails to complete execution within the preset execution cycle will be directly interrupted and discarded. The fuse mechanism ensures the integrity and real-time performance of the preset execution cycle.
[0072] As an optional but non-limiting implementation, the preset execution period is greater than or equal to the sum of the execution times of the logic execution chains.
[0073] In this embodiment, a limit is imposed on the scale of the logic execution chain, that is, the sum of the execution time of all logic blocks needs to be less than a predetermined preset execution cycle.
[0074] The execution cycle of the logic execution chain can be subdivided into the time of reading the abstract syntax tree from the abstract syntax tree cache, the time of executing the abstract syntax tree, the time of updating the state machine, and the time of releasing the candidate memory. The calculation formula of the preset execution cycle T can be expressed as:
[0075] ;
[0076] Among them, Ta is the time to read the abstract syntax tree from the abstract syntax tree cache, Tz is the time to execute the abstract syntax tree, Tm is the time to update the state machine, and Tg is the time to release the candidate memory.
[0077] It should be noted that the fuse mechanism is aimed at the time Tz that occurs when the abstract syntax tree is executed. It ensures that the state machine update and candidate memory can be fully executed.
[0078] The technical solution of the embodiment of the present invention builds an abstract syntax tree by real-time parsing of the logic flow description language file, periodically executes the logic execution chain of the abstract syntax tree at a specific frequency, and outputs the output result, thereby realizing the execution of the logic flow description language file in the low-performance hardware environment of the MCU level of the open source Hongmeng.
[0079] Embodiment 2:
[0080] Figure 3This is a schematic diagram of the structure of a runtime-based file execution device provided in the second embodiment of the present invention. This embodiment is applicable to file execution. The runtime-based file execution device can be implemented in the form of hardware and / or software. The runtime-based file execution device can be configured in any electronic device with network communication and computing capabilities. Figure 3 As shown, the device comprises:
[0081] The data parsing module 310 is used to read the parsed data from the logic flow description language file and generate an abstract syntax tree; the logic flow description language file includes syntax tree node information, and the syntax tree node information includes syntax tree node type and reference relationship between syntax tree nodes;
[0082] The data execution module 320 is used to call the built-in library function and the hardware input information according to the abstract syntax tree to execute and obtain the output result;
[0083] The data output module 330 is used to output the output result through a hardware output driver or a data service.
[0084] Optionally, the data execution module 320 includes:
[0085] Traverse each syntax tree node in the abstract syntax tree to obtain syntax tree node information;
[0086] The built-in library function is called according to the syntax tree node information, and the corresponding operation is performed in the candidate memory based on the hardware input information and the built-in library function to obtain the output result.
[0087] Optionally, the data execution module 320 includes:
[0088] Allocate candidate memory in memory and create reference count or memory pool or smart pointer reference count or resource list in the candidate memory.
[0089] Optionally, the data execution module 320 includes:
[0090] In the candidate memory, the address bit data corresponding to the identification handle in the state machine is updated according to the output result, and the identification handle is an identifier for identifying and distinguishing different output results.
[0091] Optionally, the data execution module 320 includes:
[0092] If the reference count value in the candidate memory is 0, the memory pool demand is 0, the smart pointer reference count is 0, or the resource list is 0, the candidate memory is released for garbage collection.
[0093] Optionally, the method further includes:
[0094] If a logical execution chain cannot be completed within the preset execution cycle, the fuse mechanism is triggered. The execution order of the logical execution chain is to read the abstract syntax tree from the abstract syntax tree cache, execute the abstract syntax tree, update the state machine and release the candidate memory. The fuse mechanism indicates that the execution process of the logical execution chain is interrupted according to the interrupt instruction and the candidate memory is released for garbage collection.
[0095] Optionally, the method comprises:
[0096] The preset execution period is greater than or equal to the sum of the execution times of the logic execution chains.
[0097] The runtime-based file execution device provided in the embodiment of the present invention can execute the runtime-based file execution method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0098] Embodiment three:
[0099] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0100] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.
[0101] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0102] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as a runtime-based file execution method.
[0103] In some embodiments, the runtime-based file execution method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the runtime-based file execution method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the runtime-based file execution method in any other appropriate manner (e.g., by means of firmware).
[0104] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0105] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0106] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0107] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0108] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0109] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0110] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0111] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A runtime-based file execution method, characterized in that: The method is applied to the MCU-level hardware of open source Hongmeng, including: Read parsed data from a logic flow description language file and generate an abstract syntax tree; the logic flow description language file includes syntax tree node information, and the syntax tree node information includes syntax tree node types and reference relationships between syntax tree nodes; Call built-in library functions and hardware input information according to the abstract syntax tree to execute and obtain output results; Outputting the output result through a hardware output driver or a data service; According to the abstract syntax tree, the built-in library functions and hardware input information are called to execute and the output results are obtained, including: Traverse each syntax tree node in the abstract syntax tree to obtain syntax tree node information; The built-in library function is called according to the syntax tree node information, and the corresponding operation is performed in the candidate memory based on the hardware input information and the built-in library function to obtain the output result.
2. The method according to claim 1, characterized in that Before traversing each syntax tree node in the abstract syntax tree and obtaining syntax tree node information, the following steps are performed: Allocate candidate memory in memory and create reference count or memory pool or smart pointer reference count or resource list in the candidate memory.
3. The method according to claim 1, characterized in that According to the abstract syntax tree, built-in library functions and hardware input information are called to execute and output results are obtained, including: In the candidate memory, the address bit data corresponding to the identification handle in the state machine is updated according to the output result, and the identification handle is an identifier for identifying and distinguishing different output results.
4. The method according to claim 1, characterized in that: According to the abstract syntax tree, built-in library functions and hardware input information are called to execute and output results are obtained, including: If the reference count value in the candidate memory is 0, the memory pool demand is 0, the smart pointer reference count is 0, or the resource list is 0, the candidate memory is released for garbage collection.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: If a logical execution chain cannot be completed within the preset execution cycle, the fuse mechanism is triggered. The execution order of the logical execution chain is reading the abstract syntax tree, executing the abstract syntax tree, updating the state machine, and releasing the candidate memory. The fuse mechanism indicates that the execution process of the logical execution chain is interrupted according to the interrupt instruction and the candidate memory is released for garbage collection.
6. The method according to claim 5, characterized in that The preset execution period is greater than or equal to the sum of the execution times of the logic execution chains.
7. A runtime-based file execution device, characterized in that: include: A data parsing module, used to read parsed data from a logic flow description language file and generate an abstract syntax tree; the logic flow description language file contains syntax tree node information, and the syntax tree node information includes syntax tree node types and reference relationships between syntax tree nodes; The data execution module is used to call the built-in library function and hardware input information according to the abstract syntax tree to execute and obtain the output result; A data output module, used to output the output result through a hardware output driver or a data service; The data execution module includes: Traverse each syntax tree node in the abstract syntax tree to obtain syntax tree node information; The built-in library function is called according to the syntax tree node information, and the corresponding operation is performed in the candidate memory based on the hardware input information and the built-in library function to obtain the output result.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the runtime-based file execution method as described in any one of claims 1 to 6 is implemented.
9. A storage medium storing computer executable instructions, characterized in that: When the computer executable instructions are executed by a computer processor, they are used to execute the runtime-based file execution method as described in any one of claims 1-6.
Citation Information
Patent Citations
Remote calling method and device and storage medium
CN112988406A
Domain-specific language processing method and device, medium and electronic equipment
CN117008918A