0% found this document useful (0 votes)
27 views4 pages

Lecture 4.compilers and Interpreters

A compiler is a program that translates high-level programming code into machine code, requiring compliance with syntax rules and unable to fix errors. In contrast, an interpreter converts code one statement at a time during execution, resulting in easier debugging but slower overall execution. Both serve the purpose of converting high-level languages to machine code, with compilers generating an executable file and interpreters being more memory efficient.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views4 pages

Lecture 4.compilers and Interpreters

A compiler is a program that translates high-level programming code into machine code, requiring compliance with syntax rules and unable to fix errors. In contrast, an interpreter converts code one statement at a time during execution, resulting in easier debugging but slower overall execution. Both serve the purpose of converting high-level languages to machine code, with compilers generating an executable file and interpreters being more memory efficient.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Compilers and

Interpreters
What is Compiler?
A compiler is a computer program that transforms code written in a high-level programming
language into the machine code. It is a program which translates the human-readable code
to a language a computer processor understands (binary 1 and 0 bits). The computer
processes the machine code to perform the corresponding tasks.
A compiler should comply with the syntax rule of that programming language in which it is
written. However, the compiler is only a program and cannot fix errors found in that
program. So, if you make a mistake, you need to make changes in the syntax of your
program. Otherwise, it will not compile.
What is Interpreter?
An interpreter is a computer program, which coverts each high-level program statement
into the machine code. This includes source code, pre-compiled code, and scripts. Both
compiler and interpreters do the same job which is converting higher level programming
language to machine code. However, a compiler will convert the code into machine code
(create an exe) before program run. Interpreters convert code into machine code when the
program is run.
Interpreter Compiler
Scans the entire program and translates it as a
Translates program one statement at a time.
whole into machine code.
It takes less amount of time to analyze the It takes large amount of time to analyze the
source code but the overall execution time is source code but the overall execution time is
slower. comparatively faster.
Generates intermediate object code which
No intermediate object code is generated,
further requires linking, hence requires more
hence are memory efficient.
memory.
Continues translating the program until the It generates the error message only after
first error is met, in which case it stops. Hence scanning the whole program. Hence debugging
debugging is easy. is comparatively hard.
Programming language like Python, Ruby use Programming language like C, C++ use
interpreters. compilers.

You might also like