关于语言翻译的问题

发布于 2024-10-14 19:16:51 字数 240 浏览 5 评论 0原文

我正在读一本C语言的书。 它说,

一些高级语言不是 编译但被解释。

Basic和Java是两种编程 程序经常使用的语言 解释但未编译。其他 例子包括 Unix 系统的 shell 和 Python。

C# 和 Perl 怎么样?

我认为 C# 应该始终编译,而 Perl 并不总是编译。

是这样吗?

I am reading a C Language book.
It said,

some higher-lever language are not
compiled but are interpreted.

Basic and Java are two programming
languages in which programs are ofter
interpreted and not compiled. Other
examples include the Unix system's
shell and Python.

How about C# and Perl?

I thought C# should be compiled always and Perl doesn't compiled always.

Is that right?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谎言 2024-10-21 19:16:51

C# 和 Java 都是编译的,但不是本机代码。它们被编译为字节码(分别用于公共语言运行时和Java虚拟机),由它们的VM解释。

实际上,Perl 是可以编译的,因为有一个命令行选项可以从 Perl 生成 C 代码并对其进行编译。但更一般地说,Perl 是被解释的。

Perl 和 Python 在正常运行时都会编译为字节码,然后由各自的解释器进行解释。与Java和C#不同,运行前不需要编译。

根据 C 书籍的定义,只有将语言编译为直接在 CPU 上运行而无需运行时的本机代码(例如汇编语言)时,才可以对语言进行编译。

C# and Java are both compiled, but not to native code. They are compiled to bytecode (for the Common Language Runtime and Java Virtual Machine, respectively), which is interpreted by their VM.

Perl can be compiled, actually, since there's a command line option to produce C code from Perl and compile that. But more generally, Perl is interpreted.

Both Perl and Python, when run normally, are compiled to bytecode which is then interpreted by their respective interpreters. There is no required compilation before running, unlike Java and C#.

By the definitions of your C book, languages are only compiled if they are compiled to native code (e.g. assembly) that runs directly on the CPU with no runtime.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文