Scripting Language vs Programming Language

356,418

Solution 1

Scripting languages are programming languages that don't require an explicit compilation step.

For example, in the normal case, you have to compile a C program before you can run it. But in the normal case, you don't have to compile a JavaScript program before you run it. So JavaScript is sometimes called a "scripting" language.

This line is getting more and more blurry since compilation can be so fast with modern hardware and modern compilation techniques. For instance, V8, the JavaScript engine in Google Chrome and used a lot outside of the browser as well, actually compiles the JavaScript code on the fly into machine code, rather than interpreting it. (In fact, V8's an optimizing two-phase compiler.)

Also note that whether a language is a "scripting" language or not can be more about the environment than the language. There's no reason you can't write a C interpreter and use it as a scripting language (and people have). There's also no reason you can't compile JavaScript to machine code and store that in an executable file (and people have). The language Ruby is a good example of this: The original implementation was entirely interpreted (a "scripting" language), but there are now multiple compilers for it.

Some examples of "scripting" languages (e.g., languages that are traditionally used without an explicit compilation step):

  • Lua
  • JavaScript
  • VBScript and VBA
  • Perl

And a small smattering of ones traditionally used with an explicit compilation step:

  • C
  • C++
  • D
  • Java (but note that Java is compiled to bytecode, which is then interpreted and/or recompiled at runtime)
  • Pascal

...and then you have things like Python that sit in both camps: Python is widely used without a compilation step, but the main implementation (CPython) does that by compiling to bytecode on-the-fly and then running the bytecode in a VM, and it can write that bytecode out to files (.pyc, .pyo) for use without recompiling.

That's just a very few, if you do some research you can find a lot more.

Solution 2

To understand the difference between a scripting language and a programming language, one has to understand why scripting languages were born.

Initially, there were programming languages that was written to build programs like excel, word, browsers, games and etc. These programs were built with languages like c and java. Overtime, these programs needed a way for users to create new functionality, so they had to provide an interface to their bytecode and hence scripting languages were born.

A scripting language usually isnt compiled so can run as soon as you write something meaningful. Hence excel may be built using C++ but it exposes a scripting language called VBA for users to define functionality. Similarly browsers may be built with C++/Java but they expose a scripting language called javascript (not related to java in any way). Games, are usually built with C++ but expose a language called Lua for users to define custom functionality.

A scripting language usually sits behind some programming language. Scripting languages usually have less access to the computers native abilities since they run on a subset of the original programming language. An example here is that Javascript will not be able to access your file system. Scripting languages are usually slower than programming languages.

Although scripting languages may have less access and are slower, they can be very powerful tools. One factor attributing to a scripting languages success is the ease of updating. Do you remember the days of java applets on the web, this is an example of running a programming language (java) vs running a scripting language (javascript). At the time, computers were not as powerful and javascript wasn't as mature so Java applets dominated the scenes. But Java applets were annoying, they required the user to sort of load and compile the language. Fast forward to today, Java applets are almost extinct and Javascript dominates the scene. Javascript is extremely fast to load since most of the browser components have been installed already.

Lastly, scripting languages are also considered programming languages (although some people refuse to accept this) - the term we should be using here is scripting languages vs compiled languages.

Solution 3

All scripting languages are programming languages.

Languages are not classed as script or not - it entirely depends on the execution environment.

If the environment is one that is interpreted, this is commonly referred to as a scripting environment.

Solution 4

The differences are becoming fewer and less important. Traditionally, scripting languages extend existing programs... I think that's the main definition of "scripting" is that it refers to writing a set of instructions for an existing entity to perform. However, where scripting languages started with proprietary and colloquial syntax, most of the prevalent ones these days owe some relationship to 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?

Solution 5

Programming Language : Is compiled to machine code and run on the hardware of the underlying Operating System.

Scripting Language : Is unstructure subset of programming language. It is generally interpreted. it basically "scripts" other things to do stuff. The primary focus isn't primarily building your own apps but getting an existing app to act the way you want, e.g. JavaScript for browsers, TCL etc.,

*** But there are situation where a programming language is converted to interpreter and vice-verse like use have a C interpreter where you can 'C' Script. Scripts are generally written to control an application behaviour where as Programming Language is use to build applications. But beware that the demarcation is blurring day - by - day as an example of Python it depends on how one uses the language.

Share:
356,418
Rahul Reddy
Author by

Rahul Reddy

Updated on July 20, 2022

Comments

  • Rahul Reddy
    Rahul Reddy almost 2 years

    Can anyone explain the difference between Scripting Language and Programming Language please?
    Also can you state some examples for each. I have Googled a lot but I always find the best answers from Stack Overflow.