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.
In some cases, a computer language is designed to make it easy to program toward a specific end, such as an interactive web application, but the designers do not want to include custom compilers, interpreters or plug-ins for different systems. In these cases, the intermediate language of the compiler can be an existing language that already has established cross-platform interpreters. The resulting intermediate language in this case is human readable. One example of a computer programming language that also is used as an intermediate language is JavaScript®, which has the advantage of being able to run in nearly any web browser on any platform, as of 2011.