🗣️ Interpreter

6th Grade 💻 Coding

An interpreter is a program that reads code and carries it out as it goes, line by line, without first making a complete translated file.

Free · US Letter · no sign-up
Google Classroom Save to Pinterest Email me

If a compiler is a book translator, an interpreter is a live interpreter at a meeting: it translates and acts on each sentence the moment it’s spoken. The advantage: you can run code right away and try things quickly, which is great for learning. The downside: it’s usually slower than a program that was compiled ahead of time.

Python and JavaScript are usually run by an interpreter (in practice, behind the scenes there’s a mix of both methods). That’s why, when an error happens while the program is running, the lines before it have already run and the lines after it haven’t. In Python, you can also open an interactive window where you type a line and see the result immediately.

For example

  • Type 2 + 3 in Python’s interactive window, and 5 appears right away.
  • In a Python program with an error on line 5, the first four lines already ran before the program stopped.

📌 Remember: Interpreter = live translator. Compiler = book translator.

Quick quiz

  1. What does an interpreter do?

  2. Which language is usually run by an interpreter?

  3. Why is an interpreter handy for learning?

🔎 Ask Thinkapedia another question