+ 1

What is the difference between a script and a program?

9th May 2018, 11:54 AM
KK Bhatt
KK Bhatt - avatar
2 Answers
+ 6
Script is interpreted, which means it runs without the need for an executable. A program is compiled, which means it can only be run through an executable. But scripts can be turned into an executable, however a small version of the interpreter still comes with it. Examples of script: .js, .py, .rb Example of program: .exe
9th May 2018, 11:56 AM
apex137
apex137 - avatar
+ 2
Expanding a bit on Jericho's excellent answer: a script still needs an executable called the interpreter. A good example would be the HTML/CSS/JS suite (even though they're not all scripting languages). A browser is little more then an interpretor for those languages. A compiled program is a bunch of machine language code that is loaded by the OS directly into the CPU and executed. If this code does not use the syscall instruction (the instruction that tells the os to do something, like open a file), it can be loaded directly onto the CPU (however this requires a bit of assembly code, to make the storage media bootable, and then to call the main function of the program). On the other hand, when it comes to interpreted languages, the code does not need to be converted from a high-level language down to machine code (aka compiled). Instead, a compiled program takes a look at the instructions of the higher level language one at a time and executes them. A scripting language isn't just any programming language however. For example R and the Wolfram Language are interpreted languages, but they're not scripting languages. A scripting language is a language which automates something that can be done manually. For example, renaming hundreds of files, replacing text, and so on. All these are scripts.
9th May 2018, 1:13 PM
Vlad Serbu
Vlad Serbu - avatar