LLMpediaThe first transparent, open encyclopedia generated by LLMs

Compiler

Generated by DeepSeek V3.2
Note: This article was automatically generated by a large language model (LLM) from purely parametric knowledge (no retrieval). It may contain inaccuracies or hallucinations. This encyclopedia is part of a research project currently under review.
Article Genealogy
Parent: Jeffrey Ullman Hop 4
Expansion Funnel Raw 87 → Dedup 0 → NER 0 → Enqueued 0
1. Extracted87
2. After dedup0 (None)
3. After NER0 ()
4. Enqueued0 ()
Compiler
NameCompiler
DeveloperVarious
Released0 1952
GenreSystem software

Compiler. A compiler is a specialized computer program that transforms source code written in a programming language (the source language) into another computer language (the target language), often to create an executable machine code program. This process, known as compilation, involves performing lexical analysis, syntax analysis, semantic analysis, and code generation, enabling efficient execution by computer hardware. Compilers are fundamental to software development, bridging the gap between high-level human-readable instructions and the low-level operations understood by processors.

Overview

The primary function of a compiler is to translate the entire body of source code, written in languages like C, Fortran, or Java, into a functionally equivalent program in a target language, which is frequently the instruction set of a specific CPU. This is distinct from an interpreter, which executes instructions directly without a separate compilation step. The compilation process is typically organized into distinct phases, including the front end and back end, which handle language-specific and machine-specific tasks respectively. Key outputs can include object code, assembly language, or bytecode for virtual machines like the Java virtual machine. Successful compilation depends on rigorous error detection and correction to handle issues in the source code.

Design and implementation

Compiler design is a well-established subfield of computer science, with major components including the lexer, parser, and code optimizer. The front end, responsible for syntax analysis, often uses formal grammars and tools like yacc or GNU Bison to generate parsers from a context-free grammar specification. The back end focuses on code generation and optimization, mapping intermediate representations to specific machine code using techniques such as register allocation and instruction scheduling. Pioneering concepts like single-pass compiler design and the use of symbol tables were established in early works, including the IBM FORTRAN compiler. Modern practices often involve just-in-time compilation, as seen in the V8 engine for JavaScript.

Types of compilers

Compilers are categorized based on their input, output, and operational method. A cross-compiler produces code for a platform different from the one on which it runs, essential in embedded system development for architectures like ARM. A source-to-source compiler, or transpiler, translates between high-level languages, such as from TypeScript to JavaScript. A just-in-time compiler, used by environments like the Common Language Runtime in the .NET Framework, compiles bytecode to machine code during program execution. Other specialized types include the retargetable compiler, designed to easily support new instruction sets, and the optimizing compiler, which applies transformations to improve performance, a key feature of compilers like GCC and LLVM.

History

The theoretical foundations for compilers were laid by Grace Hopper, who developed the first compiler, named A-0 System, for the UNIVAC I in 1952. The landmark FORTRAN compiler, developed by John Backus and his team at IBM in 1957, demonstrated that high-level language translation could produce efficient machine code. The development of ALGOL 60 introduced formal language description using Backus–Naur form, profoundly influencing parser design. In the 1970s, Stephen C. Johnson created the portable C compiler for the Unix operating system on the PDP-11, while the advent of object-oriented programming languages like Smalltalk and C++ drove new compilation techniques. The GNU Compiler Collection, initiated by Richard Stallman, and the LLVM project, founded by Chris Lattner, represent major open-source compiler infrastructures that have shaped modern software development.

Notable compilers

Many compilers have had a significant impact on computing. The GNU Compiler Collection (GCC), originally for the C language, is a cornerstone of free and open-source software, used extensively on systems like Linux. The LLVM compiler infrastructure, with its front end Clang, provides a modular alternative to GCC and is central to development for Apple's platforms including macOS and iOS. The Java compiler (javac) and the HotSpot virtual machine are critical to the Java platform. For the C# language, the Roslyn compiler provides rich APIs for code analysis. Other historically significant compilers include the Turbo Pascal compiler by Borland, the Visual C++ tools from Microsoft, and the IBM PL/I compiler.

Category:System software Category:Programming tools Category:Compilers