1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Program vs Script

  1. Aug 2, 2013 #1
    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?
     
  2. jcsd
  3. Aug 2, 2013 #2

    berkeman

    User Avatar

    Staff: Mentor

    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?
     
  4. Aug 2, 2013 #3
    Here are the wikipedia answers: -
    Script:
    Program:
    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.
     
  5. Aug 3, 2013 #4

    harborsparrow

    User Avatar
    Gold Member

    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).
     
  6. Aug 3, 2013 #5

    phinds

    User Avatar
    Gold Member
    2016 Award

    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.
     
  7. Aug 3, 2013 #6

    NascentOxygen

    User Avatar

    Staff: Mentor

    I'm wondering what you might mean by 'strict'? Is this perhaps your translation from another language?

    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.
     
  8. Aug 3, 2013 #7

    harborsparrow

    User Avatar
    Gold Member

    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.
     
  9. Aug 3, 2013 #8

    rcgldr

    User Avatar
    Homework Helper

  10. Aug 3, 2013 #9

    phinds

    User Avatar
    Gold Member
    2016 Award

    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.
     
  11. Aug 3, 2013 #10

    rcgldr

    User Avatar
    Homework Helper

    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.
     
  12. Aug 3, 2013 #11

    phinds

    User Avatar
    Gold Member
    2016 Award

    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.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Program vs Script
  1. A shell script doubt (Replies: 5)

  2. Unix script problem (Replies: 1)

Loading...