A compiler is a specialized program that translates source code written in a high-level programming language into machine code or intermediate code that a computer's processor can execute. This process involves several stages, including lexical analysis, syntax analysis, semantic analysis, optimization, and code generation. Compilers enable developers to write code in a more human-readable form while ensuring that it can be executed efficiently by the machine. Popular examples include GCC for C/C++ and javac for Java.