脚本语言与编程语言 [英] Scripting Language vs Programming Language

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

问题描述

任何人都可以解释脚本语言和编程语言之间的区别吗?
您还可以为每个示例说明一些示例.我已经在Google上搜索了很多,但是我总是从Stack Overflow中找到最好的答案.

Can anyone explain the difference between Scripting Language and Programming Language please?
Also can you state some examples for each. I have Googled a lot but I always find the best answers from Stack Overflow.

推荐答案

脚本语言是不需要显式编译步骤的编程语言.

Scripting languages are programming languages that don't require an explicit compilation step.

例如,在正常情况下,您必须先编译C程序,然后才能运行它.但是在通常情况下,您不必在运行JavaScript程序之前就对其进行编译.因此,JavaScript有时被称为脚本"语言.

For example, in the normal case, you have to compile a C program before you can run it. But in the normal case, you don't have to compile a JavaScript program before you run it. So JavaScript is sometimes called a "scripting" language.

由于现代硬件和现代编译技术的编译速度如此之快,因此该行变得越来越模糊.例如,V8是Google Chrome浏览器中的JavaScript引擎,并且也在浏览器之外使用了很多东西,实际上将JavaScript代码动态地编译为机器代码,而不是对其进行解释. (实际上,V8是一个优化的两阶段编译器.)

This line is getting more and more blurry since compilation can be so fast with modern hardware and modern compilation techniques. For instance, V8, the JavaScript engine in Google Chrome and used a lot outside of the browser as well, actually compiles the JavaScript code on the fly into machine code, rather than interpreting it. (In fact, V8's an optimizing two-phase compiler.)

还请注意,一种语言是否为脚本"语言可能比该语言更多地与环境有关.没有理由您不能编写C解释器并将其用作脚本语言(人们已经拥有).也没有理由不能将JavaScript编译为机器代码并将其存储在可执行文件中(人们已经拥有). Ruby语言就是一个很好的例子:最初的实现已被完全解释(一种脚本"语言),但是现在有多个编译器.

Also note that whether a language is a "scripting" language or not can be more about the environment than the language. There's no reason you can't write a C interpreter and use it as a scripting language (and people have). There's also no reason you can't compile JavaScript to machine code and store that in an executable file (and people have). The language Ruby is a good example of this: The original implementation was entirely interpreted (a "scripting" language), but there are now multiple compilers for it.

脚本"语言的一些示例(例如,在没有显式编译步骤的情况下传统上使用的语言):

Some examples of "scripting" languages (e.g., languages that are traditionally used without an explicit compilation step):

  • Lua
  • JavaScript
  • VBScript和VBA
  • Perl

和少量传统一起用于显式编译步骤:

And a small smattering of ones traditionally used with an explicit compilation step:

  • C
  • C ++
  • D
  • Java (但请注意,Java被编译为字节码,然后在运行时进行解释和/或重新编译)
  • 帕斯卡
  • C
  • C++
  • D
  • Java (but note that Java is compiled to bytecode, which is then interpreted and/or recompiled at runtime)
  • Pascal

...然后在这两个阵营中都有类似Python之类的东西:Python被广泛使用而无需编译步骤,但是主要实现(CPython)通过即时编译为字节码然后运行虚拟机中的字节码,它可以将该字节码写出到文件(.pyc.pyo)中,而无需重新编译即可使用.

...and then you have things like Python that sit in both camps: Python is widely used without a compilation step, but the main implementation (CPython) does that by compiling to bytecode on-the-fly and then running the bytecode in a VM, and it can write that bytecode out to files (.pyc, .pyo) for use without recompiling.

这只是很少的 个,如果您进行一些研究,您会发现更多的东西.

That's just a very few, if you do some research you can find a lot more.

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

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