📜  编译器和解释器之间的区别

📅  最后修改于: 2021-06-28 07:32:31             🧑  作者: Mango

1.编译器
它是一种翻译器,接受输入(即高级语言),并产生低级语言(即机器或汇编语言)的输出。

  • 编译器比汇编器更智能,它可以检查各种限制,范围,错误等。
  • 但是它的程序运行时间更多,并且占用了很大一部分内存。它的速度很慢,因为编译器会遍历整个程序,然后将整个程序转换为机器代码。

图–编译器进程

2.口译员
解释器是将程序设计语言翻译成可理解的语言的程序。 –

  • 一次仅翻译该程序的一条语句。
  • 口译员通常比编译器小。

图–解释程序

让我们看看编译器和解释器之间的区别:

S.No. Compiler Interpreter
1. Compiler scans the whole program in one go. Translates program one statement at a time.
2. As it scans the code in one go, the errors (if any) are shown at the end together. Considering it scans code one line at a time, errors are shown line by line.
3. Main advantage of compilers is it’s execution time. Due to interpreters being slow in executing the object code, it is preferred less.
4. It converts the source code into object code. It does not convert source code into object code instead it scans it line by line
5 It does not require source code for later execution. It requires source code for later execution.
Eg. C, C++, C# etc. Python, Ruby, Perl, SNOBOL, MATLAB, etc.