开发者

Question on Language Interpreter

开发者 https://www.devze.com 2023-02-07 12:07 出处:网络
I am reading a C Language book. It said, some higher-lever language are not compiled but are interpreted.

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 n开发者_运维问答ot 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号