What Is an Intermediate Language?
In computer programming, when human-readable source code is parsed by a compiler, the compiler often translates the source commands into a sequence of instructions that are not quite native machine code but can be further processed, optimized or compiled by the compiler or other software tools. The files that are produced contain instructions that are said to be in an intermediate language, because the language used by the compiler is neither meaningful to the larger operating system nor the language used by the programmer to write the code in the first place, but instead is a language that acts as a bridge between the writing and execution of the program. An intermediate language sometimes is used to allow a compiler to make very precise optimizations so the program runs more efficiently, but it also can be used to produce output files that are portable between different, incompatible systems. The actual syntax of the language can resemble machine code or other types of non-human readable bytecode, or the language can be just an existing cross-platform computer programming language.
When used for compiler optimization, a language compiler takes each statement in a source code file and breaks the command down into the intermediate language. A single human-readable programming statement can break down into dozens of machine language instructions, so the intermediate language creates a level of abstraction that the compiler can use to identify areas of the code where optimizations can be made without first having to bind the code to any native implementations or libraries. Once completed, the intermediary code file can then be compiled further to make a native binary file, or it can be run through another program, known as an interpreter, that will execute the code by compiling it into native instructions as needed.
Some languages, such as Java®, use an intermediate language to create compiled files that are optimized but also portable to other computer systems. This type of code sometimes is known as bytecode and resembles machine code or assembly language. Bytecode is stored in files in a way that is platform-independent, meaning it can be transferred to any computer system or device that can run an interpreter. Once the bytecode is on a system, it can either be run as an interpreted program or it can be compiled to run natively on the target system.
Discuss this Article
Post your comments