Saturday, May 2, 2009

Scripting Languages

One enigmatic question that I find people often have a hard time giving a straight answer to is "What is the difference between a 'normal' programming language, such as C++, and a scripting language." This question leads to a lot of backpedalling and out spews a lot of general non-specific answers.

The term 'Scripting Language' refers to one of two different things. The specific definition refers to a programming language that controls software. An example of this would be QuakeC, which allows writing scripts for the popular fps game, Quake. Another example would be ASP, which works on the server side to dynamically generate web pages.

The generic term 'Scripting Language' refers to any language, whether used for specific applications or for general purposes, which is interpreted instead of compiled. An example of this general definition would be Python or Ruby.

"Aaah, now I get it." But what exactly is the difference between a language being compiled and a language being interpreted. An interpreted language is one that instead of compiled, is 'interpreted' and run at the same time. Essentially an interpreter is a dynamic compiler. it interprets each line of code in your program into machine code and then runs it at the moment. This contrasts to a language that must be compiled into machine code all at once and then run.

While an interpreted language runs slower, the syntax is often more powerful, interpreted languages allow for things such as implicit typing, which means you don't have to declare the types of your variables, and that you can change them on the fly. Programs or 'Scripts' often take a lot less time to write then if they were written in an a compiled language.

As a last note, I prefer the stricter definition of "Scripting Language", and generally so do programmers who use languages such as Python. If you have any expert knowledge of interpreted languages, please share below.