A compiler is a software program that translates source code written in a programming language into machine code that can be executed by a computer.