Interpreter: Difference between revisions
From Coderwiki
More actions
info, disadvantages, bytecode |
info, advantages, disadvantages, bytecode interpreters |
||
| Line 3: | Line 3: | ||
Instead of ''converting'' the [[source code]] into [[machine code]] like a [[compiler]] would, an interpreter instead steps through each [[Computer instruction|instruction]] of the [[program]] and executes code based on this. | Instead of ''converting'' the [[source code]] into [[machine code]] like a [[compiler]] would, an interpreter instead steps through each [[Computer instruction|instruction]] of the [[program]] and executes code based on this. | ||
== | == Interpreted languages == | ||
=== Advantages of interpreted languages === | |||
* Very little [[overhead]], so programs can be run and [[Testing|tested]] quickly, allowing for [[rapid iteration]] | |||
=== Disadvantages of interpreted languages === | |||
* Generally [[Performance|slower execution]] | * Generally [[Performance|slower execution]] | ||
* The interpreter must be installed on the user's system | * The interpreter must be installed on the user's system | ||
| Line 10: | Line 15: | ||
== Bytecode interpreters == | == Bytecode interpreters == | ||
With some interpreters such as the [[Python|python interpreter]] and the [[Java Virtual Machine]], instead of stepping through the [[source code]], the source code is instead first [[Compiler|compiled]] into an [[intermediate representation]], such as [[bytecode]]. This IR is then '''interpreted'''. | With some interpreters such as the [[Python|python interpreter]] and the [[Java Virtual Machine]], instead of stepping through the [[source code]], the source code is instead first [[Compiler|compiled]] into an [[intermediate representation]], such as [[bytecode]]. This IR is then '''interpreted'''. | ||
These [[bytecode]] interpreters are often known as [[Process virtual machine|process virtual machines]]. | |||
Latest revision as of 07:49, 13 August 2025
An interpreter is used in order to interpret the source code of an interpreted language so the computer understands the program.
Instead of converting the source code into machine code like a compiler would, an interpreter instead steps through each instruction of the program and executes code based on this.
Interpreted languages
edit edit sourceAdvantages of interpreted languages
edit edit source- Very little overhead, so programs can be run and tested quickly, allowing for rapid iteration
Disadvantages of interpreted languages
edit edit source- Generally slower execution
- The interpreter must be installed on the user's system
Bytecode interpreters
edit edit sourceWith some interpreters such as the python interpreter and the Java Virtual Machine, instead of stepping through the source code, the source code is instead first compiled into an intermediate representation, such as bytecode. This IR is then interpreted.
These bytecode interpreters are often known as process virtual machines.