CN113687833A - Hybrid compiling method, hybrid compiling system, compiler, and storage medium - Google Patents

Hybrid compiling method, hybrid compiling system, compiler, and storage medium Download PDF

Info

Publication number
CN113687833A
CN113687833A CN202110911916.2A CN202110911916A CN113687833A CN 113687833 A CN113687833 A CN 113687833A CN 202110911916 A CN202110911916 A CN 202110911916A CN 113687833 A CN113687833 A CN 113687833A
Authority
CN
China
Prior art keywords
code
generate
information
hybrid
standard
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110911916.2A
Other languages
Chinese (zh)
Inventor
戴正国
郭福坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Inovance Technology Co Ltd
Original Assignee
Shenzhen Inovance Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Inovance Technology Co Ltd filed Critical Shenzhen Inovance Technology Co Ltd
Priority to CN202110911916.2A priority Critical patent/CN113687833A/en
Publication of CN113687833A publication Critical patent/CN113687833A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/51Source to source
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/425Lexical analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/436Semantic checking

Landscapes

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

Abstract

The invention discloses a hybrid compiling method, a hybrid compiling system, a compiler and a storage medium, and belongs to the technical field of language compiling. The method comprises the steps of obtaining a source code through a text file of an editor, carrying out standard correction according to the source code to generate a preprocessing code, carrying out back-end analysis according to the preprocessing code to generate mixed compiling information, and carrying out machine language conversion according to the mixed compiling information to generate a target machine code. According to the invention, standard correction is carried out on the source code, the preprocessed code meets the standard specification and accords with the code execution requirements of different target platforms, mixed compiling information is generated through back-end analysis, the target machine code is generated according to the mixed compiling information, auxiliary compiling of the target platform is not needed, and mixed compiling adaptive to a plurality of target platforms is realized.

Description

Hybrid compiling method, hybrid compiling system, compiler, and storage medium
Technical Field
The present invention relates to the field of language compilation technologies, and in particular, to a hybrid compilation method, a hybrid compilation system, a compiler, and a storage medium.
Background
The compiling refers to a process of converting a high-level language into a machine language, the high-level language is convenient for people to write, read, communicate and maintain, the machine language can be directly interpreted and operated by a computer, and a compiler can take a high-level language source program as input and translate the high-level language source program into an equivalent program of a target language machine code. At present, a compiler needs to be compiled by depending on hardware and a system of a target platform, and cannot be combined with other information output by interpretation and execution to generate an executable machine code of the target platform, and only one machine code executable by the target platform can be output after one-time compilation is performed on the same source code.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide a hybrid compiling method, a hybrid compiling system, a compiler and a storage medium, and aims to solve the technical problem that the compiler relies on target platform hardware and a system to perform compiling in the prior art.
To achieve the above object, the present invention provides a hybrid compilation method, including the steps of:
acquiring a source code through a text file of an editor;
performing standard correction according to the source code to generate a preprocessing code;
performing back-end analysis according to the preprocessed codes to generate mixed compiling information;
and performing machine language conversion according to the mixed compiling information to generate a target machine code.
Optionally, the performing standard modification according to the source code to generate a preprocessing code includes:
performing non-standard variable conversion according to the source code to generate a standard variable code;
carrying out error detection according to the standard variable code to generate error information;
and correcting the error of the standard address code according to the error information to generate a preprocessing code.
Optionally, the performing non-canonical variable conversion according to the source code to generate a standard variable code includes:
performing instruction extraction according to the source code to generate instruction information;
and performing non-standard variable conversion on the source code according to the instruction information to generate a standard variable code.
Optionally, the performing instruction extraction according to the source code to generate instruction information includes:
performing lexical analysis according to the source code to generate keyword information;
and performing instruction extraction on the source code according to the keyword information to generate instruction information.
Optionally, the performing error detection according to the standard variable code to generate error information includes:
writing the standard variable code into a forward statement to generate a standard definition code;
and carrying out error detection according to the standard definition code to generate error information.
Optionally, the performing error detection according to the standard definition code to generate error information includes:
performing address mapping conversion according to the standard definition code to generate a standard address code;
and carrying out error detection according to the standard address code to generate error information.
Optionally, the performing back-end analysis according to the preprocessed codes to generate hybrid compilation information includes:
performing lexical analysis according to the preprocessing codes to generate lexical information;
and carrying out syntax and semantic analysis on the preprocessed codes according to the lexical information to generate mixed compiling information.
In addition, to achieve the above object, the present invention further provides a hybrid compiling system that implements the hybrid compiling method described above, the hybrid compiling system including: the system comprises a preprocessing module, an analysis module and a machine language conversion module;
the preprocessing module is used for acquiring a source code through a text file of an editor;
the preprocessing module is also used for carrying out standard correction according to the source code to generate a preprocessing code;
the analysis module is used for carrying out back-end analysis according to the preprocessing codes to generate mixed compiling information;
and the machine language conversion module is used for performing machine language conversion according to the mixed compiling information to generate a target machine code.
In addition, to achieve the above object, the present invention further provides an editor, including: a memory, a processor, and a hybrid compiler stored on the memory and executable on the processor, the hybrid compiler configured to implement the steps of the hybrid compiling method as described above.
In addition, to achieve the above object, the present invention further provides a storage medium having a hybrid compiler stored thereon, wherein the hybrid compiler realizes the steps of the hybrid compiling method as described above when being executed by a processor.
The method comprises the steps of obtaining a source code through a text file of an editor, carrying out standard correction according to the source code to generate a preprocessing code, carrying out back-end analysis according to the preprocessing code to generate mixed compiling information, and carrying out machine language conversion according to the mixed compiling information to generate a target machine code. According to the invention, standard correction is carried out on the source code, the preprocessed code meets the standard specification and accords with the code execution requirements of different target platforms, mixed compiling information is generated through back-end analysis, the target machine code is generated according to the mixed compiling information, auxiliary compiling of the target platform is not needed, and mixed compiling adaptive to a plurality of target platforms is realized.
Drawings
FIG. 1 is a diagram illustrating an editor of a hardware runtime environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a hybrid compiling method according to a first embodiment of the invention;
FIG. 3 is a flowchart illustrating a hybrid compiling method according to a second embodiment of the invention;
fig. 4 is a block diagram of a hybrid compiling system according to a first embodiment of the invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic diagram of an editor architecture of a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the editor may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a Wireless interface (e.g., a Wireless-Fidelity (Wi-Fi) interface). The Memory 1005 may be a Random Access Memory (RAM) Memory, or may be a Non-Volatile Memory (NVM), such as a disk Memory. The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration shown in FIG. 1 does not constitute a definition of an editor, and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a storage medium, may include therein an operating system, a network communication module, a user interface module, and a hybrid compiler program.
In the editor shown in fig. 1, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the editor of the present invention may be disposed in the editor, and the editor calls the hybrid compiler stored in the memory 1005 through the processor 1001 and executes the XX method provided by the embodiment of the present invention.
An embodiment of the present invention provides a hybrid compiling method, and referring to fig. 2, fig. 2 is a flowchart illustrating a first embodiment of the hybrid compiling method according to the present invention.
In this embodiment, the hybrid compiling method includes the following steps:
step S10: the source code is obtained through a text file of the editor.
It should be noted that the execution subject of the hybrid compiling method may be a hybrid compiling system or a compiler, and during the hybrid compiling process, the source code needs to be acquired first. Source code is a tool that programmers write when creating a software program, the source code being written in a particular programming language and saved in a text-based, human-readable format so that the source code cannot be run directly by a computer.
It should be understood that, because there are many kinds of working platforms, i.e., target platforms, such as an X86 platform, an ARM platform, a RISC platform, etc., a conventional compiler cannot compile a software code into an executable machine code conforming to a plurality of target platforms at one time, and the compiling process needs to depend on hardware and systems of the target platforms (e.g., an interpreter of the target platform).
Step S20: and performing standard correction according to the source code to generate a preprocessing code.
It is easy to understand that the standard modification is performed according to the source code, and the generation of the pre-processing code is a pre-processing process of mixed compilation and is executed by the pre-processing module. In order to enable the programming code, namely the source code, to meet the standardized specification after one-time correction, the standardized specification of the standard correction is set according to the compiling and code program running requirements of the target platform, such as the requirements of correct syntax semantics or no unrecognizable characters and the like. After standard correction is performed on the source code, a preprocessing code can be generated, and the preprocessing code is a code generated after the source code is preprocessed.
Step S30: and performing back-end analysis according to the preprocessing codes to generate mixed compiling information.
It is understood that the back-end analysis process may include lexical analysis and semantic analysis, which are performed by the analysis module, wherein the analysis module may include a lexical analysis module based on FLEX and a semantic analysis module based on BISON, the lexical analysis may be performed by the lexical analysis module based on FLEX and the semantic analysis may be performed by the semantic analysis module based on BISON. The hybrid compilation information may include instruction labels, symbol tables, and a wrapper library, among other things, which may be used to convert symbols in the code file into external symbols for relocation by the target machine execution.
Step S40: and performing machine language conversion according to the mixed compiling information to generate a target machine code.
It is easy to understand that the machine language conversion according to the hybrid compilation information may be performed by a machine language conversion module, which may be an LLVM-based machine language conversion module. The machine language conversion module generates executable machine codes of different target platforms, namely target machine codes, through the application program interface, and outputs the target machine codes to the target platform so that the target platform executes related code programs to run.
In this embodiment, a source code is obtained through a text file of an editor, a standard correction is performed according to the source code to generate a preprocessing code, a back-end analysis is performed according to the preprocessing code to generate mixed compiling information, and a machine language conversion is performed according to the mixed compiling information to generate a target machine code. According to the embodiment, the source code is subjected to standard correction, the preprocessed code meets the standard specification and meets the code execution requirements of different target platforms, the mixed compiling information is generated through back-end analysis, the target machine code is generated according to the mixed compiling information, auxiliary compiling of the target platforms is not needed, and mixed compiling adaptive to a plurality of target platforms is achieved.
Referring to fig. 3, fig. 3 is a flowchart illustrating a hybrid compiling method according to a second embodiment of the invention.
Based on the first embodiment, the step S20 in the hybrid compilation method of this embodiment includes:
step S201: and performing lexical analysis according to the source code to generate keyword information.
It should be noted that lexical analysis is performed according to the source code, and generating keyword information is performed for the first time in a hybrid compiling process, so as to firstly eliminate the lexical problem, avoid useless subsequent preprocessing process caused by lexical errors and influence on compiling efficiency, the keyword information is obtained by scanning the source code and performing lexical analysis, and the keyword information may include keywords (such as include, define, undef, if, error, and the like) and keyword position information.
Step S202: and performing instruction extraction on the source code according to the keyword information to generate instruction information.
It can be understood that the position of the keyword can be determined according to the keyword information, and the statement where the keyword is located can be determined as the corresponding instruction according to the symbols before and after the keyword, so that the instruction information can be generated, and the instruction information can be important information for setting a command for a code file so as to enable the corresponding program to execute the command.
Step S203: and performing non-standard variable conversion on the source code according to the instruction information to generate a standard variable code.
It should be understood that, since the source code is edited in a high-level language, non-canonical variables, i.e., non-english canonical variables and functions, may exist in the source code, and the non-canonical variables need to be converted into canonical variables, i.e., english, so as to meet the standard specification of the target platform compilation.
Step S204: and writing a forward statement according to the standard variable code to generate a standard definition code.
It is easy to understand that the forward declaration is based on an auxiliary tool provided by the subsequent machine language conversion, and the forward declaration is written to define a variable or a function in the code file, so as to avoid that the machine language conversion process cannot correctly recognize the meaning of a symbol of the variable or the function in the code file.
Step S205: and performing address mapping conversion according to the standard definition code to generate a standard address code.
It is understood that the central processing unit receives logical addresses during execution of the program, and the logical addresses must be mapped into physical addresses to access the real physical memory. The mapping of the logical address of the standard definition code to the physical address of the target platform may include two steps, first, the mapping of the logical address of the standard definition code to the linear address needs to be converted, and the linear address needs to be mapped again to the physical address of the target platform.
Step S206: and carrying out error detection according to the standard address code to generate error information.
It is easy to understand that the preprocessing process of performing standard correction according to the source code may cause many problems due to source code errors or other information generation or conversion errors, which directly results in compilation far from the expected effect, therefore, error detection needs to be performed on the standard address code, the error detection may include error forms such as syntax errors, type errors, declaration errors, etc., and error information may be generated according to the detected structure, and the error information may include error forms and error positions.
Step S207: and correcting the error of the standard address code according to the error information to generate a preprocessing code.
It is easy to understand that the hybrid compiling system can return error information to the operator for modification, or the hybrid compiling system can scan the whole code, and the code file is modified in an auxiliary manner by combining the meaning of symbols such as variables and functions in the code file, and the standard address code can generate a preprocessing code after error correction, and the error position and the modification position can be marked when the code file is modified in an auxiliary manner, or the preprocessing code can be generated after the operator checks the modification content.
In this embodiment, the step S30 includes:
step S301: and performing lexical analysis according to the preprocessing codes to generate lexical information.
It can be understood that lexical analysis is performed according to the preprocessed codes, the lexical analysis module based on FLEX performs corresponding analysis in the process of generating lexical information, lexical analysis is performed for the second time in the mixed compiling process, and the compiling errors in the process of converting the high-level language into the machine language are further reduced by performing the lexical analysis on the code files again.
Step S302: and carrying out syntax and semantic analysis on the preprocessed codes according to the lexical information to generate mixed compiling information.
It is easy to understand that, syntax and semantic analysis are performed on the preprocessed codes according to the lexical information, the process of generating the hybrid compilation information can be correspondingly analyzed by a BISON-based syntax and semantic analysis module, if errors exist in the analyzed lexical, syntax and semantic, an error report can be generated to revise the preprocessed codes again to reduce compilation errors, and relevant information of the code file is extracted after no errors exist to generate the hybrid compilation information, which can include instruction labels, symbol tables, a packaging library and the like, and the packaging library can be used for converting symbols in the code file into external symbols for a target machine to perform relocation.
The embodiment is adapted to mixed compilation by preprocessing a source code, wherein the preprocessing process comprises the steps of firstly scanning the source code and acquiring keyword information through lexical analysis, finding out various types of instructions according to the keyword information, secondly converting non-standard variables and functions in a code file into standard variables, automatically adding forward declaration to the code file, namely the standard definition code, so as to ensure correct compilation during machine language conversion, mapping and converting variable logic addresses of the standard definition code and target platform physical addresses, finally carrying out error real-time monitoring, correction and output on compilation to obtain a preprocessed code, carrying out new lexical scanning and syntax semantic analysis on the preprocessed code to obtain mixed compilation information, generating a target machine code according to the mixed compilation information, and needing no target platform to assist in compilation, the accuracy and efficiency of hybrid compilation adapting to multiple target platforms are further improved.
Furthermore, an embodiment of the present invention further provides a storage medium, where a hybrid compiler program is stored, and when being executed by a processor, the hybrid compiler program implements the steps of the hybrid compiling method as described above.
Since the storage medium adopts all technical solutions of all the embodiments, at least all the beneficial effects brought by the technical solutions of the embodiments are achieved, and no further description is given here.
Referring to fig. 4, fig. 4 is a block diagram illustrating a hybrid compiling system according to a first embodiment of the invention.
As shown in fig. 4, the hybrid compiling system according to the embodiment of the present invention includes: the system comprises a preprocessing module, an analysis module and a machine language conversion module;
the preprocessing module 10 is configured to obtain a source code through a text file of an editor.
It should be understood that, because there are many kinds of working platforms, i.e., target platforms, such as an X86 platform, an ARM platform, a RISC platform, etc., a conventional compiler cannot compile a software code into an executable machine code conforming to a plurality of target platforms at one time, and the compiling process needs to depend on hardware and systems of the target platforms (e.g., an interpreter of the target platform).
The preprocessing module 10 is further configured to perform standard modification according to the source code to generate a preprocessing code.
It is easy to understand that the standard modification is performed according to the source code, and the generation of the pre-processing code is a pre-processing process of mixed compilation and is executed by the pre-processing module. In order to enable the programming code, namely the source code, to meet the standardized specification after one-time correction, the standardized specification of the standard correction is set according to the compiling and code program running requirements of the target platform, such as the requirements of correct syntax semantics or no unrecognizable characters and the like. After standard correction is performed on the source code, a preprocessing code can be generated, and the preprocessing code is a code generated after the source code is preprocessed.
The analysis module 20 is configured to perform back-end analysis according to the preprocessed codes, and generate hybrid compilation information.
It is understood that the back-end analysis process may include lexical analysis and semantic analysis, which are performed by the analysis module, wherein the analysis module may include a lexical analysis module based on FLEX and a semantic analysis module based on BISON, the lexical analysis may be performed by the lexical analysis module based on FLEX and the semantic analysis may be performed by the semantic analysis module based on BISON. The hybrid compilation information may include instruction labels, symbol tables, and a wrapper library, among other things, which may be used to convert symbols in the code file into external symbols for relocation by the target machine execution.
The machine language conversion module 30 is configured to perform machine language conversion according to the hybrid compilation information to generate a target machine code.
It is easy to understand that the machine language conversion according to the hybrid compilation information may be performed by a machine language conversion module, which may be an LLVM-based machine language conversion module. The machine language conversion module generates executable machine codes of different target platforms, namely target machine codes, through the application program interface, and outputs the target machine codes to the target platform so that the target platform executes related code programs to run.
In this embodiment, a source code is obtained through a text file of an editor, a standard correction is performed according to the source code to generate a preprocessing code, a back-end analysis is performed according to the preprocessing code to generate mixed compiling information, and a machine language conversion is performed according to the mixed compiling information to generate a target machine code. According to the embodiment, the source code is subjected to standard correction, the preprocessed code meets the standard specification and meets the code execution requirements of different target platforms, the mixed compiling information is generated through back-end analysis, the target machine code is generated according to the mixed compiling information, auxiliary compiling of the target platforms is not needed, and mixed compiling adaptive to a plurality of target platforms is achieved.
In an embodiment, the preprocessing module 10 is further configured to perform non-canonical variable conversion according to the source code, and generate a standard variable code; carrying out error detection according to the standard variable code to generate error information; and correcting the error of the standard address code according to the error information to generate a preprocessing code.
In an embodiment, the preprocessing module 10 is further configured to perform instruction extraction according to the source code, and generate instruction information; and performing non-standard variable conversion on the source code according to the instruction information to generate a standard variable code.
In an embodiment, the preprocessing module 10 is further configured to perform lexical analysis according to the source code to generate keyword information; and performing instruction extraction on the source code according to the keyword information to generate instruction information.
In an embodiment, the preprocessing module 10 is further configured to write a forward declaration according to the standard variable code, and generate a standard definition code; and carrying out error detection according to the standard definition code to generate error information.
In an embodiment, the preprocessing module 10 is further configured to perform address mapping conversion according to the standard definition code, and generate a standard address code; and carrying out error detection according to the standard address code to generate error information.
In an embodiment, the analysis module 20 is further configured to perform lexical analysis according to the preprocessed codes, and generate lexical information; and carrying out syntax and semantic analysis on the preprocessed codes according to the lexical information to generate mixed compiling information.
Since the hybrid compiling system adopts all the technical solutions of all the embodiments, at least all the beneficial effects brought by the technical solutions of the embodiments are achieved, and no further description is given here.
It should be understood that the above is only an example, and the technical solution of the present invention is not limited in any way, and in a specific application, a person skilled in the art may set the technical solution as needed, and the present invention is not limited thereto.
It should be noted that the above-described work flows are only exemplary, and do not limit the scope of the present invention, and in practical applications, a person skilled in the art may select some or all of them to achieve the purpose of the solution of the embodiment according to actual needs, and the present invention is not limited herein.
In addition, the technical details that are not described in detail in this embodiment may refer to the hybrid compiling method provided in any embodiment of the present invention, and are not described herein again.
Further, it is to be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention or portions thereof that contribute to the prior art may be embodied in the form of a software product, where the computer software product is stored in a storage medium (e.g. Read Only Memory (ROM)/RAM, magnetic disk, optical disk), and includes several instructions for enabling a terminal device (e.g. a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A hybrid compilation method, comprising:
acquiring a source code through a text file of an editor;
performing standard correction according to the source code to generate a preprocessing code;
performing back-end analysis according to the preprocessed codes to generate mixed compiling information;
and performing machine language conversion according to the mixed compiling information to generate a target machine code.
2. The hybrid compilation method of claim 1 wherein the generating pre-processed code by performing standard modifications from the source code comprises:
performing non-standard variable conversion according to the source code to generate a standard variable code;
carrying out error detection according to the standard variable code to generate error information;
and correcting the error of the standard address code according to the error information to generate a preprocessing code.
3. The hybrid compilation method of claim 2, wherein the non-canonical variable conversion from the source code to generate a standard variable code, comprising:
performing instruction extraction according to the source code to generate instruction information;
and performing non-standard variable conversion on the source code according to the instruction information to generate a standard variable code.
4. The hybrid compilation method of claim 3, wherein the performing instruction extraction from the source code to generate instruction information comprises:
performing lexical analysis according to the source code to generate keyword information;
and performing instruction extraction on the source code according to the keyword information to generate instruction information.
5. The hybrid compilation method of claim 2, wherein the error detecting and generating error information based on the standard variable code comprises:
writing a forward statement according to the standard variable code to generate a standard definition code;
and carrying out error detection according to the standard definition code to generate error information.
6. The hybrid compilation method of claim 5 wherein the performing error detection based on the standard definition code to generate error information comprises:
performing address mapping conversion according to the standard definition code to generate a standard address code;
and carrying out error detection according to the standard address code to generate error information.
7. The hybrid compiling method according to any one of claims 1 to 6 wherein the performing a back-end analysis based on the preprocessed code to generate hybrid compiling information comprises:
performing lexical analysis according to the preprocessing codes to generate lexical information;
and carrying out syntax and semantic analysis on the preprocessed codes according to the lexical information to generate mixed compiling information.
8. A hybrid compilation system that implements the hybrid compilation method of any one of claims 1 to 7, the hybrid compilation system comprising: the system comprises a preprocessing module, an analysis module and a machine language conversion module;
the preprocessing module is used for acquiring a source code through a text file of an editor;
the preprocessing module is also used for carrying out standard correction according to the source code to generate a preprocessing code;
the analysis module is used for carrying out back-end analysis according to the preprocessing codes to generate mixed compiling information;
and the machine language conversion module is used for performing machine language conversion according to the mixed compiling information to generate a target machine code.
9. An editor, the editor comprising: a memory, a processor, and a hybrid compiler stored on the memory and executable on the processor, the hybrid compiler configured to implement the hybrid compilation method of any of claims 1 to 7.
10. A storage medium having stored thereon a hybrid compiler program which, when executed by a processor, implements the hybrid compilation method according to any one of claims 1 to 7.
CN202110911916.2A 2021-08-09 2021-08-09 Hybrid compiling method, hybrid compiling system, compiler, and storage medium Pending CN113687833A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110911916.2A CN113687833A (en) 2021-08-09 2021-08-09 Hybrid compiling method, hybrid compiling system, compiler, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110911916.2A CN113687833A (en) 2021-08-09 2021-08-09 Hybrid compiling method, hybrid compiling system, compiler, and storage medium

Publications (1)

Publication Number Publication Date
CN113687833A true CN113687833A (en) 2021-11-23

Family

ID=78579410

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110911916.2A Pending CN113687833A (en) 2021-08-09 2021-08-09 Hybrid compiling method, hybrid compiling system, compiler, and storage medium

Country Status (1)

Country Link
CN (1) CN113687833A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115495093A (en) * 2022-11-07 2022-12-20 深圳鲲云信息科技有限公司 Hybrid compiling method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101315606A (en) * 2008-05-08 2008-12-03 李湘江 Method for VB and VC program mixed compiling link
CN109918081A (en) * 2019-03-01 2019-06-21 中安智联未来有限公司 A kind of Compilation Method and compiler
CN110134378A (en) * 2018-02-08 2019-08-16 腾讯科技(深圳)有限公司 Application program creation method and device, computer equipment and storage medium
CN110494843A (en) * 2017-04-03 2019-11-22 创首公司 Mixing model programming
CN111736838A (en) * 2019-03-25 2020-10-02 华为技术有限公司 Cross-language compiling method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101315606A (en) * 2008-05-08 2008-12-03 李湘江 Method for VB and VC program mixed compiling link
CN110494843A (en) * 2017-04-03 2019-11-22 创首公司 Mixing model programming
CN110134378A (en) * 2018-02-08 2019-08-16 腾讯科技(深圳)有限公司 Application program creation method and device, computer equipment and storage medium
CN109918081A (en) * 2019-03-01 2019-06-21 中安智联未来有限公司 A kind of Compilation Method and compiler
CN111736838A (en) * 2019-03-25 2020-10-02 华为技术有限公司 Cross-language compiling method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115495093A (en) * 2022-11-07 2022-12-20 深圳鲲云信息科技有限公司 Hybrid compiling method and device, electronic equipment and storage medium
CN115495093B (en) * 2022-11-07 2023-07-21 深圳鲲云信息科技有限公司 Hybrid compiling method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US6434742B1 (en) Symbol for automatically renaming symbols in files during the compiling of the files
USRE38104E1 (en) Method and apparatus for resolving data references in generated code
CN108139896B (en) Extended virtual machine instruction set architecture
US6353925B1 (en) System and method for lexing and parsing program annotations
US6378126B2 (en) Compilation of embedded language statements in a source code program
US20060271920A1 (en) Multilingual compiler system and method
US20110138373A1 (en) Method and apparatus for globally optimizing instruction code
EP0476635A2 (en) Self identifying objects in computer systems
US20090138847A1 (en) Optimized code generation by eliminating unused virtual function
KR101213890B1 (en) Using strong data types to express speech recognition grammars in software programs
CN112379917B (en) Browser compatibility improving method, device, equipment and storage medium
US7257806B1 (en) System and method for efficiently passing information between compiler and post-compile-time software
US10545743B2 (en) Enhanced programming language source code conversion with implicit temporary object emulation
CN111913741B (en) Object interception method, device, medium and electronic equipment
US6625807B1 (en) Apparatus and method for efficiently obtaining and utilizing register usage information during software binary translation
CN113703779B (en) Cross-platform multi-language compiling method and ultra-light Internet of things virtual machine
CN113687833A (en) Hybrid compiling method, hybrid compiling system, compiler, and storage medium
MXPA03004411A (en) System and method for defining and using subclasses declaratively within markup.
CN116595967A (en) Natural language rule writing method based on text and related device
Kramer et al. Reflection in attribute grammars
JP7391983B2 (en) Methods, decompiling devices, recompilation systems and computer program products for generating representations of program logic
KR20090011974A (en) Method for extracting the target files of compilation
Kurš et al. Efficient parsing with parser combinators
CN111796832A (en) Hot patch file generation method, device, equipment and storage medium
CN117270962B (en) Method and device for processing coloring language, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination