Program vs Script: Understanding the Differences and Purposes

  • Thread starter Thread starter jd12345
  • Start date Start date
  • Tags Tags
    Program
AI Thread Summary
The discussion clarifies the distinctions between programs and scripts, noting that scripts are typically interpreted and often modified by end-users, while programs are compiled into executable forms. It highlights that scripts are generally considered lightweight and less strict than compiled programs, although the reasons for this difference remain unclear. The conversation also addresses the terminology confusion, asserting that not all interpretive languages are classified as scripts, with historical examples like BASIC and APL being labeled as programs despite their interpretive nature. Additionally, it emphasizes that the classification of a language as a script or program can depend on context and usage rather than strict definitions. Ultimately, the nuances of scripting versus programming languages continue to provoke thoughtful debate among users.
jd12345
Messages
251
Reaction score
2
I am having this doubt for a long time and want to clear once and for all.
Here are the questions: -
1) What is the difference between program and script? (I believe program is run on a machine while script is run on another software but still I want your answers in case I am wrong)
2) Why are scripts lightweight and not that strict compared to compiled programs?
3) Why are scripts interpretive but programs compiled?
 
Physics news on Phys.org
jd12345 said:
I am having this doubt for a long time and want to clear once and for all.
Here are the questions: -
1) What is the difference between program and script? (I believe program is run on a machine while script is run on another software but still I want your answers in case I am wrong)
2) Why are scripts lightweight and not that strict compared to compiled programs?
3) Why are scripts interpretive but programs compiled?

Your answer to #1 is not quite right, IMO. Can you try again? And what are your answers to the rest of the questions? Have you tried looking up definitions for these terms?
 
berkeman said:
Your answer to #1 is not quite right, IMO. Can you try again? And what are your answers to the rest of the questions? Have you tried looking up definitions for these terms?

Here are the wikipedia answers: -
Script:
"Scripts" are distinct from the core code of the application, which is usually written in a different language, and are often created or at least modified by the end-user.
Scripts are often interpreted from source code or bytecode, whereas the applications they control are traditionally compiled to native machine code.

Program:
The program has an executable form that the computer can use directly to execute the instructions.
The same program in its human-readable source code form, from which executable programs are derived (e.g., compiled)

So scripts are interpreted while programs are compiled. Since these are the definitions there is no point asking why this is so.

So the question remaining is: Why are scripts lightweight and not so strict?
I find no reason why they can't be.

Another question which comes: Are all interpretive languages scripts?
From the definition I suppose yes.
 
A scripting language is just a programming language like any other. A program written in a scripting language, however, may not compile down to an executable file--which means, to run it, you'll need the source code. From the point of view of the programmer herself, it makes little difference (except, possibly, for performance).
 
jd12345 said:
So scripts are interpreted while programs are compiled.

Not always true. The original BASIC language was the earliest wide-spread interpretive language and programs written in it were never called "scripts", they were called "programs" and were thought of as such. The fact that they were interpreted at run-time was irrelevant.

Similarly, APL, an early interpreted language was the same in that programs written in APL were never thought of or described as "scripts" but as "programs".

On the other hand, complex programs written in JavaScript are not likely to be thought of or described as "scripts" but as "programs" even though they are written in a scripting language.
 
jd12345 said:
So the question remaining is: Why are scripts lightweight and not so strict? I find no reason why they can't be.
I'm wondering what you might mean by 'strict'? Is this perhaps your translation from another language?

Another question which comes: Are all interpretive languages scripts?
From the definition I suppose yes.
There is a grey area where either term could apply, IMHO, and the designers seem to have settled on one term or the other in their early published documentation, and then it sticks.
 
Technically speaking, the fact that you had source code (and not an executable file), when moving a function from one user or machine to another, was probably the first reason people started calling them scripts rather than programs.

Often that was because they were interpreted, but that is no longer the case in all situations.
 
jd12345 said:
Are all interpretive languages scripts?

Actually, you are confusing terminology here. A "script" is a program not a language. The right form would be "are all scripting languages interpretive" and I think the answer to that is yes although as has been mentioned, interpretive languages may have compilers.
 
  • #10
If you read the wiki article, scripting is more like what dos or windows call batch files and linux / posix / unix calls shell scripts, placing commands normally entered one at a time by the user into a text file. Usually there are additional features such as looping, conditionals, "calling" or "spawning" of other scripts. There are also more general purpose scripting languages, and I don't know where the line is drawn between a scripting language and an interpretive language.

I would consider APL and Basic to be interpretive languages, not scripting languages. Even though APL and Basic can be used interactively like a calculator, they also include the ability to define functions.
 
  • #11
rcgldr said:
I would consider APL and Basic to be interpretive languages, not scripting languages. Even though APL and Basic can be used interactively like a calculator, they also include the ability to define functions.

JavaScript is by definition a scripting language but can easily be used to write complex programs, including functions. As I said earlier, I don't think any such programs would be called scripts, but a very small JavaScript program might be.
 
Back
Top