There are two main ways to implement a programming language:
A compiler transforms the source code into another language. This is usually executable machine code, but it can be another language for which an implementation already exists.
An interpreter is a program that reads source code and evaluates it. Interpreters are typically simpler to implement than compilers, but there is some overhead involved with re-reading the source every time the program is executed.
Many languages adopt a hybrid of these two - for example, Python code is compiled to Python bytecode which is then interpreted. Some languages have both interpreters and compilers available for them.
That's true, but they both come down to some translation from the source code to instructions: one is done in advance, and the other on the fly. I felt that the difference was not crucial for this article, but it's a good point.
2 comments
[ 2.3 ms ] story [ 15.7 ms ] threadA compiler transforms the source code into another language. This is usually executable machine code, but it can be another language for which an implementation already exists.
An interpreter is a program that reads source code and evaluates it. Interpreters are typically simpler to implement than compilers, but there is some overhead involved with re-reading the source every time the program is executed.
Many languages adopt a hybrid of these two - for example, Python code is compiled to Python bytecode which is then interpreted. Some languages have both interpreters and compilers available for them.