解释与编译语言 [英] interpreted vs compiled language

查看:65
本文介绍了解释与编译语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们怎么知道java是解释语言,而c#是编译语言?
解释语言和编译语言之间的基本区别?

预先感谢您答复

how do we know java is interpreted language but c# is compiled language ?
Basic difference between interpreted language and compiled language ?

thanks in advance for replying

推荐答案

否,Java不是解释语言. Java和所有.NET语言都是已编译的语言,但是编译已完成为字节代码(Java机器为一个字节代码,.NET CLR为另一个字节代码, Common Language Runtime ).在这两种变体中,字节码都使用及时编译(JIT)在运行时转换为机器码.

参见:
http://en.wikipedia.org/wiki/Just-in-time_compilation [ ^ ],
http://en.wikipedia.org/wiki/Bytecode [ http://en.wikipedia.org/wiki/Managed_code [
No, Java is not interpreted language. Java and all .NET languages are compiled languages, but the compilation is done into the byte code (one byte code for Java machine, another for .NET CLR, Common Language Runtime). In both variants, the byte code is translated to machine code during run time, using just-in-time compilation (JIT).

See:
http://en.wikipedia.org/wiki/Just-in-time_compilation[^],
http://en.wikipedia.org/wiki/Bytecode[^],
http://en.wikipedia.org/wiki/Managed_code[^].

Strictly speaking, being interpreted or compiled language is not a characteristic of a language itself, as a language can be interpreted and compiled at the same time. It makes the last question not quite correct, as the whole picture is more complex that assumed by this question. Some languages are interpreted only, as they are designed the way making compilation impossible. Discussion of this topic would leads us well beyond quick questions and answers. Understanding and classification of different languages need some of real education and deep understanding of programming, not something that could be conducted as a set of basic facts.

—SA


您不知道.就您的代码而言,它无法分辨出有什么区别-指令是按相同的顺序执行的,无论是解释代码还是编译代码.

为通常解释的语言生成编译器是完全可行的,反之亦然.实际上,C#()和其他.NET语言通过使用JIT编译器等来模糊区分.

Wiki中有一篇您可能应该阅读的文章:
http://en.wikipedia.org/wiki/Compiler [ ^ ]
You don''t. As far as your code is concerned, it can''t tell that there is a difference - the instructions are executed in the same sequence whether the code is interpreted or compiled.

It is perfectly feasible to produce a compiler for a language that is normally interpreted, and vice versa. In fact, C# ()and other .NET languages blur the distinction by using JIT compilers and so forth.

Wiki has an article you probably should read: http://en.wikipedia.org/wiki/Compiler[^]


这篇关于解释与编译语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆