How Are Programming Languages Made?
What is a Programming Language Implementation?
A programming language is defined by its specification (grammar, semantics). Its implementation is a compiler or interpreter that executes code written in that language. CPython implements Python; rustc implements Rust; V8 implements JavaScript.
What Compilers and Interpreters Do
A compiler translates source code to machine code or bytecode ahead of time. A interpreter reads and executes source code directly. Most languages use one or both: Java compiles to bytecode, then the JVM interprets or JIT-compiles that bytecode.
The Bootstrap Problem
To write a compiler for a new language, you need an existing language to write it in. Early compilers were written in assembly or C. Once a compiler is stable, it can be rewritten in the language itself — this is called bootstrapping. Languages like Rust, Go, Haskell, and OCaml are self-hosting: their compilers are written in themselves.
Examples from the Dataset
- Python (CPython) is implemented in C
- Rust (rustc) is self-hosting, with an original OCaml implementation
- Go has been self-hosting since version 1.5 (2015)
- JavaScript engines (V8, SpiderMonkey, JavaScriptCore) are written in C++
- Java (javac) is self-hosting; the HotSpot JVM is written in C++