Nepedia
Back to Discover
Fluent Reader
💻

Interpreter (computing)

technology Maturity 7-9 Next article →

An interpreter is a special kind of software. It allows a computer to run source code directly. Most programs use a compiler to work. A compiler translates code into machine code before it ever runs. An interpreter does not do that first step. Instead, it executes the code as it reads it.

W3sDesign Interpreter Design Pattern UML
W3sDesign Interpreter Design Pattern UML

This makes interpreters very helpful for many tasks. They can run on any platform with a matching interpreter. This means you do not need a new version for every computer.

How does an interpreter work? It often uses a middle step to be faster. It might turn the source code into bytecode first. Bytecode is an intermediate format that is easier to read. Some systems use just-in-time compilation, or JIT. JIT turns that bytecode into machine code while the program is running. This helps the program run at a high speed.

W3sDesign Interpreter Design Pattern UML
W3sDesign Interpreter Design Pattern UML

Other interpreters use an abstract syntax tree. This is a way to map out the program structure. The interpreter then follows this tree to perform the tasks.

Interpreters have a long and interesting history. In the early days, compilers were much more common. This was because old hardware could not support interpreters easily. However, people used interpreters as early as 1952. They helped programmers work around limited storage space. The first high-level language to use an interpreter was Lisp.

W3sDesign Interpreter Design Pattern UML
W3sDesign Interpreter Design Pattern UML

Steve Russell implemented Lisp on an IBM 704 computer. He turned a theory from John McCarthy into a working tool. This helped shape Lisp into the form we know today.

There are many specific facts about how they are used. Interpreters are often used for commands and scripts. They are also used for virtualization. This is when an interpreter acts like a virtual machine. It can even emulate a different computer system.

W3sDesign Interpreter Design Pattern UML
W3sDesign Interpreter Design Pattern UML

In the 1960s, time-sharing systems made editing interpreters very important. This allowed many people to use one computer at once. One early example was the EDT system. It was built for the PDP-1 computer in the late 1960s.

Using an interpreter is like having a live translator. A compiler is like a book translator who finishes the whole book first. An interpreter translates each sentence as you speak it. This makes the process slower for the computer. This extra work is called interpretive overhead.

W3sDesign Interpreter Design Pattern UML
W3sDesign Interpreter Design Pattern UML

However, it is much faster for the person writing the code. You can change a line and test it right away. This short cycle is great for testing new ideas. It balances speed for the person with speed for the machine.

424 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (1)
File:W3sDesign Interpreter Design Pattern UML.jpg
W3sDesign Interpreter Design Pattern UML.jpg
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.