Intermediate language
"Intermediate language"即"中间语言"。
Wikipedia Intermediate language
In computer science, an intermediate language is the language of an abstract machine designed to aid in the analysis of computer programs.
NOTE: 面向计算的
The term comes from their use in compilers, where the source code of a program is translated into a form more suitable for code-improving transformations before being used to generate object or machine code for a target machine.
A popular format for intermediate languages is three-address code.
The term is also used to refer to languages used as intermediates by some high-level programming languages which do not output object or machine code themselves, but output the intermediate language only.
This is usually done to ease the process of optimization or to increase portability by using an intermediate language that has compilers for many processors and operating systems, such as C. Languages used for this fall in complexity between high-level languages and low-level languages, such as assembly languages.
Intermediate representation
A canonical example is found in most modern compilers, where the linear human-readable text representing a program is transformed into an intermediate graph data structure that allows flow analysis and re-arrangements before starting to create the list of actual CPU instructions that will do the work. Use of an Intermediate representation allows compiler systems like GNU GCC and LLVM to be targeted by many different source languages, and support generation for many different target architectures.
Case study
NOTE: 源自 Wikipedia Intermediate language 。主要是在compiler中应用。
Three-address code
NOTE: 最最流行的
C as intermediate language
Though not explicitly designed as an intermediate language, C's nature as an abstraction of assembly and its ubiquity as the de facto system language in Unix-like and other operating systems has made it a popular intermediate language: Eiffel, Sather, Esterel, some dialects of Lisp (Lush, Gambit), Haskell (Glasgow Haskell Compiler), Squeak's Smalltalk-subset Slang, Cython, Seed7, SystemTap, Vala, and others make use of C as an intermediate language.
Language for VM
Any language targeting a virtual machine can be considered an intermediate language:
- Java bytecode
- Microsoft's Common Intermediate Language is an intermediate language designed to be shared by all compilers for the .NET Framework, before static or dynamic compilation to machine code.
- While most intermediate languages are designed to support statically typed languages, the Parrot intermediate representation is designed to support dynamically typed languages—initially Perl and Python.
- TIMI is a high level that targets the IBM System i platform.
NOTE: 下面是一些补充
Python bytecode
sqlite bytecode
GCC IR
The GNU Compiler Collection (GCC) uses several intermediate languages internally to simplify portability and cross-compilation. Among these languages are
- the historical Register Transfer Language (RTL)
- the tree language GENERIC
- the SSA-based GIMPLE.
- Standard Portable Intermediate Representation SPIR/SPIR-V
- LLVM Intermediate Representation
- HSA Intermediate Layer
LLVM IR
The LLVM compiler framework is based on the LLVM IR intermediate language, which has been productized by Apple as "bitcode".[1][2]
Deep learning IR
参见工程machine-learning的Theory\Deep-learning\Guide\Compiler
章节。