In computer programming, a programming language implementation is a system for executing computer programs. There are two general approaches to programming language implementation: Interpretation: The program is read as input by an interpreter, which performs the actions written in the program. Compilation: The program is read by a compiler, which translates it into some other language, such as bytecode or machine code. The translated code may either be directly executed by hardware, or serve as input to another interpreter or another compiler. Interpreter (computing) An interpreter is composed of two parts: a parser and an evaluator. After a program is read as input by an interpreter, it is processed by the parser. The parser breaks the program into language components to form a parse tree. The evaluator then uses the parse tree to execute the program. A virtual machine is a special type of interpreter that interprets bytecode. Bytecode is a portable low-level code similar to machine code, though it is generally executed on a virtual machine instead of a physical machine. To improve their efficiencies, many programming languages such as Java, Python, and C# are compiled to bytecode before being interpreted. Some virtual machines include a just-in-time (JIT) compiler to improve the efficiency of bytecode execution. While the bytecode is being executed by the virtual machine, if the JIT compiler determines that a portion of the bytecode will be used repeatedly, it compiles that particular portion to machine code. The JIT compiler then stores the machine code in memory so that it can be used by the virtual machine. JIT compilers try to strike a balance between longer compilation time and faster execution time. Compiler A compiler translates a program written in one language into another language. Most compilers are organized into three stages: a front end, an optimizer, and a back end. The front end is responsible for understanding the program.
Martin Odersky, Vlad Ureche, Cristian Talau