有人能解释一下脚本语言和程序设计语言的区别吗? 你也可以举一些例子。我谷歌了很多,但我总是从Stack Overflow找到最好的答案。


当前回答

在世界还很年轻的时候,在PC世界中,你可以从。exe或。bat中选择,描述很简单。Unix系统一直都有shell脚本(/bin/sh, /bin/csh, /bin/ksh等)和编译语言(C/ c++ /Fortran)。

To differentiate roles and responsibilities, the compiled languages (often referred to as 3rd Generation Languages) were seen a 'programming' languages and 'scripting' languages were seen as those that invoked an interpreter (often referred to as 4th Generation Languages). Scripting languages were often used as 'glue' to connect between multiple commands/compiled programs so that the user didn't have to worry about a set of steps in order to carry out their task - they developed a single file, that delineated what steps they wanted to accomplish, and this became a 'script' for anyone to follow.

Various people/groups wrote new interpreters to solve a specific problem domain. awk is one of the better-known ones, and it was used mostly for pattern matching and applying a series of data transforms on input. It worked well, but had a limited problem domain. The expansion of that domain was all but impossible because the source code was unavailable. Perl (Larry Wall, principle author/architect) tool scripting to the next level - and developed an interpreter that not only allowed the user to run system commands, manipulate input and output data, supported typeless variables, but also to access Unix system level APIs as functions from within the scripts themselves. It was probably one of the first widely used high-level scripting languages. It is with Perl (IMHO) that scripting languages crossed the arbitrary line and added the capabilities of programming languages.

你的问题是关于Python的。因为python解释器是针对包含python代码的文本文件运行的,而且python代码可以在任何有python解释器的地方运行,所以我认为它是一种脚本语言(与Perl相同)。您不需要为每个不同的OS/CPU架构重新编译用户python命令文件(就像使用C/ c++ /Fortran一样),这使得它更易于移植和使用。

这个答案要归功于杰罗德·海曼(Jerrold Heyman)。 原帖:https://www.researchgate.net/post/Is_Python_a_Programming_language_or_Scripting_Language

其他回答

我不同意使用解释器的语言是脚本语言,而被编译的是编程语言。我们可以为任何语言开发解释器或编译器。解释环境更适合web脚本编写,使它更容易,这就是为什么我们有它。

嗯,我觉得脚本语言和编程语言之间没有任何区别。一切都是为了完成工作。当涉及到与web相关的任务时,我们把它们称为web脚本,考虑到小任务,这样我们也可以把与系统相关的任务称为系统或操作系统级脚本,我们用来完成这些任务的编程语言称为系统脚本语言。

同样,这并不是说不能用Python编写系统级代码,不能用C语言编写Web脚本(如果我们能够建立所需的平台和环境,当然可以这样做)。但它所需要的是太多的努力,这可能会影响快速开发的时间限制,而减少的一点点延迟对我们的web脚本没有多大好处。但如果我们在Python中执行系统级任务,则相反。

底线:语言选择取决于要执行的任务的性质,将一种语言区分为脚本语言是一个神话。

编程语言: 编译为机器码并在底层操作系统的硬件上运行。

脚本语言: 是编程语言的非结构子集。这是一般的解释。 它基本上是“脚本”其他事情来做事情。主要的重点不是构建你自己的应用程序,而是让现有的应用程序以你想要的方式运行,例如浏览器的JavaScript, TCL等。

***但也有编程语言被转换为解释器的情况,反之亦然,比如使用C解释器,你可以使用C脚本。 脚本通常用于控制应用程序的行为,而编程语言则用于构建应用程序。 但要注意的是,这种界限正在日益模糊——作为Python的一个例子,它取决于你如何使用这种语言。

这些差异正变得越来越不重要。传统上,脚本语言扩展了现有的程序……我认为这就是“脚本”的主要定义,它指的是为现有实体编写一组执行指令。然而,脚本语言起源于专有的和口语化的语法,现在流行的大多数脚本语言都与C有某种关系。

I think the "interpreted vs compiled" distinction is really a symptom of extending an existing program (with a built in interpreter), rather than an intrinsic difference. What programmers and laymen are more concerned about is, "what is the programmer doing?" The fact that one program is interpreted and another is compiled means very little in determining the difference in activity by the creator. You don't judge a playwright on whether his plays are more commonly read aloud or performed on stage, do you?

脚本语言

脚本语言是在另一个程序中解释的。JavaScript被嵌入到浏览器中,并由该浏览器进行解释。

脚本语言示例

JavaScript Perl Python

脚本语言的优点:

简单——脚本语言比编程更容易编写 语言。 更少的代码行数

编程语言

像Java这样的编程语言是由另一个应用程序以同样的方式编译和解释的。

编程语言示例

C c++和 Java

更多的细节

http://www.yorku.ca/nmw/facs1939f13/javascript_all/js_scriptingVSprogramming.html http://www.killersites.com/blog/2005/scripting-vs-programming-is-there-a-difference/

脚本语言是编程语言的一个子集。

脚本语言不会被用户编译成机器码(python、perl、shell等)。相反,另一个程序(称为解释器,运行程序并模拟其行为) 一些不是脚本的编程语言(C、c++、Haskell和其他“编译”语言)被编译成机器代码,然后运行。