本文介绍了脚本语言和其他语言有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
何时将一种语言视为脚本语言?

我真的很困惑不同类型的语言.任何人都可以指导什么是不同类型的语言或不同的类别.

I am really confused between different types of languages.Can any one guide what are diff types of languages or diff categories.

就像有人说 python 是脚本语言.这是什么意思.其他语言如 php , asp , java 不是脚本语言

Like some saying python is scripting langauge. Now what does that mean. Are other langueages like php , asp , java not scripting langauges

推荐答案

脚本语言"这个名称适用于一个非常具体的角色:您编写命令以发送到现有软件应用程序的语言.(就像传统的电视或电影剧本")

The name "Scripting language" applies to a very specific role: the language which you write commands to send to an existing software application. (like a traditional tv or movie "script")

例如,曾几何时,HTML 网页很无聊.他们总是静止的.然后有一天,Netscape 想:嘿,如果我们让浏览器读取页面中的小命令并对其执行操作会怎么样?"就这样,Javascript 就形成了.

For example, once upon a time, HTML web pages were boring. They were always static. Then one day, Netscape thought, "Hey, what if we let the browser read and act on little commands in the page?" And like that, Javascript was formed.

一个简单的 javascript 命令是 alert() 命令,它指示/命令正在读取网页的浏览器(软件应用程序)显示警报.

A simple javascript command is the alert() command, which instructs/commands the browser (a software app) that is reading the webpage to display an alert.

现在,alert() 是否与 C++ 或浏览器实际使用来显示警报的任何代码语言有关?当然不是.在 .html 页面上编写alert()"的人不了解浏览器实际如何显示警报.他只是在写一个浏览器会解释的命令.

Now, does alert() related, in any way, to the C++ or whatever code language that the browser actually uses to display the alert? Of course not. Someone who writes "alert()" on an .html page has no understanding of how the browser actually displays the alert. He's just writing a command that the browser will interpret.

让我们看看简单的javascript代码

Let's see the simple javascript code

<script>
var x = 4
alert(x)
</script>

这些是发送到浏览器的指令,供浏览器自行解释.浏览器实际使用的编程语言将变量设置为 4,并将其放入警报中......它与 javascript 完全无关.

These are instructs that are sent to the browser, for the browser to interpret in itself. The programming language that the browser goes through to actually set a variable to 4, and put that in an alert...it is completely unrelated to javascript.

我们称最后一系列命令为脚本"(这就是为什么它包含在 标签中).只是根据脚本"的定义,传统意义上的:发送给演员的一系列指令和命令.例如,每个人都知道剧本(电影剧本)就是剧本.

We call that last series of commands a "script" (which is why it is enclosed in <script> tags). Just by the definition of "script", in the traditional sense: A series of instructions and commands sent to the actors. Everyone knows that a screenplay (a movie script), for example, is a script.

剧本(剧本)不是演员、摄影机或特效.剧本只是告诉他们该怎么做.

The screenplay (script) is not the actors, or the camera, or the special effects. The screenplay just tells them what to do.

现在,脚本语言究竟是什么?

Now, what is a scripting language, exactly?

有很多编程语言就像工具箱中的不同工具;某些语言专门设计为用作脚本.

There are a lot of programming languages that are like different tools in a toolbox; some languages were designed specifically to be used as scripts.

Javasript 就是一个明显的例子;很少有 Javascript 应用程序不属于脚本领域.

Javasript is an obvious example; there are very few applications of Javascript that do not fall within the realm of scripting.

ActionScript(Flash 动画的语言)及其衍生语言是脚本语言,因为它们只是向 Flash 播放器/解释器发出命令.当然,也有面向对象编程之类的抽象概念,但所有这些都只是达到目的的一种手段:向 Flash 播放器发送命令.

ActionScript (the language for Flash animations) and its derivatives are scripting languages, in that they simply issue commands to the Flash player/interpreter. Sure, there are abstractions such as Object-Oriented programming, but all that is simply a means to the end: send commands to the flash player.

Python 和 Ruby 通常也用作脚本语言.例如,我曾经在一家公司工作,该公司使用 Ruby 编写命令发送到浏览器的脚本,这些命令类似于转到此站点,单击此链接..."以执行一些基本的自动化测试.无论如何,我在这份工作中不是一个软件开发人员".我只是编写了向计算机发送命令以向浏览器发送命令的脚本.

Python and Ruby are commonly also used as scripting languages. For example, I once worked for a company that used Ruby to script commands to send to a browser that were along the lines of, "go to this site, click this link..." to do some basic automated testing. I was not a "Software Developer" by any means, at that job. I just wrote scripts that sent commands to the computer to send commands to the browser.

由于其性质,脚本语言很少被编译"——也就是说,被翻译成机器代码,并由计算机直接读取.

Because of their nature, scripting languages are rarely 'compiled' -- that is, translated into machine code, and read directly by the computer.

即使是从 Python 和 Ruby 创建的 GUI 应用程序也是发送到用 C++ 或 C 编写的 API 的脚本.它告诉 C 应用程序要做什么.

Even GUI applications created from Python and Ruby are scripts sent to an API written in C++ or C. It tells the C app what to do.

当然,有一点含糊.为什么不能说机器语言/C 是脚本语言,因为它们是计算机用来与基本主板/显卡/芯片接口的脚本?

There is a line of vagueness, of course. Why can't you say that Machine Language/C are scripting languages, because they are scripts that the computer uses to interface with the basic motherboard/graphics cards/chips?

我们可以画一些线来澄清:

There are some lines we can draw to clarify:

  1. 当您可以编写脚本语言并在不编译"的情况下运行它时,它更像是一种直接脚本类型的东西.例如,你不需要对剧本做任何事情来告诉演员如何处理它.它已经在那里,按原样使用.出于这个原因,我们将排除编译语言称为脚本语言,即使它们在某些情况下可以用于脚本目的.

  1. When you can write a scripting language and run it without "compiling", it's more of a direct-script sort of thing. For example, you don't need to do anything with a screenplay in order to tell the actors what to do with it. It's already there, used, as-is. For this reason, we will exclude compiled languages from being called scripting languages, even though they can be used for scripting purposes in some occasions.

脚本语言意味着发送到复杂软件应用程序的命令;这就是我们首先编写脚本的全部原因——因此您无需了解软件向其发送命令的工作方式的复杂性.因此,脚本语言往往是向复杂的软件应用程序发送(相对)简单的命令的语言……在这种情况下,机器语言和汇编代码并不能解决问题.

Scripting language implies commands sent to a complex software application; that's the whole reason we write scripts in the first place -- so you don't need to know the complexities of how the software works to send commands to it. So, scripting languages tend to be languages that send (relatively) simple commands to complex software applications...in this case, machine language and assembly code don't cut it.

这篇关于脚本语言和其他语言有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 16:20