Compilers

Compilers are computer programs that translate instructions in the input language (called the source language) into the actions specified by the instructions. These actions are usually themselves represented as programs in some high-level or low-level language.

What distinguishes compilers from interpreters is that compilers translate large chunks of code all at once alongside aggressive optimizations, whereas interpreters translate and execute in an interleaved fashion with read/eval/print loops. Modern languages use a mix of interpretation and compilation - compilation for established programs and interpretation for programs under development.

One important optimization that is typically done in compilers is the use of lexical addressing - storing environment variables with addresses relative to current frame. This enables fast variable lookups, useful with deep frame stacking or environments containing many variables. Compilers can implement this by maintaining a separate compile-time environment tracking all the variables and frames.


Links

Sources