使用解释器和编译器时执行的步骤
解释型语言和编译型语言之间到底有什么区别。例如,我想打印从 1 到 100 的数字。在解释器和编译器的情况下,操作顺序是如何发生的。
另外,如果可能的话请根据Java语言和C语言提供我的步骤
Thx
What exactly the difference between interpreted and compiled language.For example I want print the numbers from 1 to 100 .How exactly the sequence of operations takes place in case of interpreter and compiler.
Further,If possible please provide me the steps in according to Java language and C language
Thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
编译语言是将源代码转换为机器代码的语言。也称为本机应用程序。
解释型语言是将源代码转换为某种中间代码的语言。在程序执行期间,解释器运行源代码。解释型语言往往(但并非总是如此)明显慢于编译型语言。然而,它们对于便携性很有用。
C 被编译,将源代码转换
为汇编代码,然后转换为机器代码。处理器获取每条机器指令并执行它。这非常快。
然而,Java 将源代码转换为中间字节代码。在运行时,它在“虚拟机”上运行,“虚拟机”可能比本机编译的应用程序慢。
A compiled language is a language which converts the source code to machine code. Also known as a native application.
An interpreted language is a language which converts the source code to some intermediate. During the execution of the program, an interpretor runs the source code. Interpreted languages tend to be, but not always are, significantly slower than compiled languages. They are useful, however, for portability.
C is compiled, turning the source code:
into assembly, then into machine code. The processor fetches each machine instruction and executes it. This is very fast.
Java, however, converts source code to an intermidiate byte code. At run-time, it is run on a "virtual-machine", which can be slower than a native compiled application.
这已经是 StackOverflow 上的常见问题解答 :-)
例如,请参阅以下答案:
实现编译器和解释器有什么区别?
解释器/编译器如何工作
This already kind of a FAQ on StackOverflow :-)
For example, see the following answers:
What is the difference between implementing a compiler and an interpreter?
How does an interpreter/compiler work