LLVM-based ST language compiling method and system and compiler
A compilation method and language technology, applied in the field of language compilation, can solve the problems of lack of universality and lack of universality in intermediate languages, and achieve the effects of convenient optimization processing, strong universality and good portability
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0049] figure 1It shows a schematic flowchart of the implementation of the LLVM-based ST language compiling method provided by this embodiment.
[0050] A kind of LLVM-based ST language compiling method provided by this embodiment includes:
[0051] Get the source code of structured text ST language;
[0052] Perform lexical analysis on the source code of structured text ST language according to the lexical rules defined by IEC61131-3, and obtain the symbol flow;
[0053] Based on the symbol stream, perform grammatical analysis on the symbol stream according to the grammatical expression defined by IEC61131-3, and obtain an abstract syntax tree representing the program structure corresponding to the source code of the ST language, and the abstract syntax tree is represented by the expression for the node;
[0054] Based on the abstract syntax tree, performing semantic analysis on the abstract syntax tree to obtain an abstract syntax tree with a type identifier;
[0055] Co...
Embodiment 2
[0063] figure 2 A block diagram of the ST language compiling system based on LLVM provided by this embodiment is shown.
[0064] A compilation system comprising:
[0065] The obtaining module is used for: obtaining the source code of the structured text ST language;
[0066] The lexical analysis module is used to: perform lexical analysis on the source code of the structured text ST language according to the lexical rules defined in IEC61131-3, and obtain the symbol flow;
[0067] The grammatical analysis module is used to: perform grammatical analysis on the symbol flow according to the grammatical expression defined by IEC61131-3, and obtain an abstract syntax tree representing the program structure corresponding to the source code of the ST language, and the abstract syntax tree is expressed in The formula is node;
[0068] A semantic analysis module, configured to: perform semantic analysis on the abstract syntax tree to obtain an abstract syntax tree with a type ident...
Embodiment 3
[0082] A compiler comprising:
[0083] The compilation system (ie, the compilation front end) is used to complete lexical analysis, syntax analysis and semantic analysis, and generate machine-independent LLVM IR;
[0084] LLVM optimizer, used to optimize LLVM IR to obtain optimized LLVM IR;
[0085] LLVM backend for generating target machine code based on optimized LLVM IR, depending on the target platform.
[0086] In some embodiments, an LLVM-based compiler such as image 3 As shown, including the front end (Frontend), the underlying virtual machine optimizer (LLVM Optimizer) and the underlying virtual machine backend (LLVM Backend). Among them, the front end is responsible for lexical analysis, syntax analysis and semantic analysis, the source code (Source Code) finally generates the underlying virtual machine intermediate code (LLVMIR), LLVM Optimizer optimizes LLVM IR, and LLVM Backend finally generates platform-specific machine code. The object processed by LLVM Optim...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More - R&D
- Intellectual Property
- Life Sciences
- Materials
- Tech Scout
- Unparalleled Data Quality
- Higher Quality Content
- 60% Fewer Hallucinations
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2025 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com



