Programming Languages – Understanding Scripting Languages

interpretersprogramming-languagesscripting

Quoted from Wikipedia:

A scripting language, script language
or extension language is a programming
language that allows control of one
or more applications
and makes the
compiler of the language part of the
language runtime
, and as a result,
enables code to be generated dynamically. "Scripts" are distinct
from the core code of the application,
as they are 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 application is
typically first compiled to native
machine code.

  1. I was wondering what "enables code
    to be generated dynamically" means?
    Isn't code in a scripting language
    written before it gets run, so how
    is it generated dynamically?
  2. By definition, is a scripting
    language always an interpreted
    language? Conversely, is an
    interpreted language always a
    scripting language? They seem to be very close related, or even
    the same thing.
  3. How is a language non-scripting?

Best Answer

There is no technical standard that defines a scripting language. It's just a word that is defined by common usage, and like any other word in common usage, there is no guarantee that all the usages are consistent. Tackling your specific questions:

  1. The dynamic code generation they are talking about is machine code. In a classic interpreted language (think BASIC interpreter), each time a line of a script is executed, that line is translated on the spot into native machine code. It's more complicated now, since many scripting languages will be translated into byte code for a virtual machine, and the byte code may get cached.

  2. This is where it gets very fuzzy, and changes with time. In ye olden days, pretty much every scripting language was a classic interpreted language. Nowadays many use byte code, virtual machines, and may use Just-in-time compilers. At that point the line between interpreted languages and compiled languages is blurry. Still, I don't know of any language commonly referred to as a scripting language that is compiled in the classic sense of a one time conversion to native machine code.

  3. Languages commonly called scripting languages usually provide a suite of high level data structures like sets, lists, and dictionaries, as well as features like regular expressions. There are interpreted languages that don't provide those high level features, and they usually aren't called scripting languages. I don't think many folks would refer to interpreted BASIC or even UCSD Pascal as a scripting language.

Related Topic