Scripting language


In computing, a script is a relatively short and simple set of instructions that typically automate an otherwise manual process. The act of writing a script is called scripting. A scripting language or script language is a programming language that is used for scripting.
Originally, scripting was limited to automating shells in operating systems, and languages were relatively simple. Today, scripting is more pervasive and some scripting languages include modern features that allow them to be used to develop application software also.

Overview

A scripting language can be a general-purpose programming language or a domain-specific language for a given environment. When embedded in an application, it may be called an extension language.
A scripting language is sometimes referred to as very high-level programming language if it operates at a high level of abstraction, or as a control language, especially for job control languages on mainframe computers.
The term scripting language is sometimes used in a wider sense, to refer to dynamic high-level programming languages in general. Some are strictly interpreted languages, while others use a form of compilation.
In this context, the term script refers to a small program in such a language. Typically, a script is contained in a single file, and no larger than a few thousand lines of code.
The scope of scripting languages ranges from small to large, and from highly domain-specific language to general-purpose programming languages. A language may start as small and highly domain-specific and later develop into a portable and general-purpose language; conversely, a general-purpose language may later develop special domain-specific dialects.

Notable languages

Script is a subjective characterization that generally includes the following attributes.

Interpreted

A script is usually not compiled, at least not its usual meaning. Generally, they are interpreted directly from source code, or from bytecode, or run as native after just-in-time compilation.

Short & simple

A script is generally relatively short and simple. As there is no limit on size or complexity, script is subjective. A few lines of code without branching is probably considered a script. A codebase of multiple files, that performs sophisticated user or hardware interface or complicated algorithms or multiprogramming is probably not considered a script.

Automates

A script usually automates a task that would otherwise be performed by a person in a more manual way.

Limited language

A language that is primarily intended for scripting generally has limited capabilities compared to a general-purpose language. A scripting language may lack the functionality to write complex applications.

Starts at the top

Typically, a script starts executing at the first line of code whereas an application typically starts at a special point in the code called the entry point.
For example, Java is not script-like since an application starts at the function named which need not be at the top of the code. The following code starts at, then calls which prints "Hello World".

public class HelloWorld

In contrast, the following Python code prints "Hello World" without the function or other syntax such as a class definition required by Java.

print

Single user

Scripts are often created or modified by the person executing them, but they are also often distributed, such as when large portions of games are written in a scripting language, notably the Google Chrome T-rex game.

History

Early mainframe computers were non-interactive, instead using batch processing. IBM's Job Control Language is the archetype of languages used to control batch processing.
The first interactive shells were developed in the 1960s to enable remote operation of the first time-sharing systems, and these used shell scripts, which controlled running computer programs within a computer program, the shell. Calvin Mooers in his TRAC language is generally credited with inventing command substitution, the ability to embed commands in scripts that, when interpreted, insert a character string into the script. Multics calls these active functions.
Louis Pouzin wrote an early processor for command scripts called RUNCOM for CTSS around 1964. Stuart Madnick at MIT wrote a scripting language for IBM's CP/CMS in 1966. He originally called this processor COMMAND, later named EXEC. Multics included an offshoot of CTSS RUNCOM, also called RUNCOM. EXEC was eventually replaced by EXEC 2 and Rexx.
Languages such as Tcl and Lua were specifically designed as general-purpose scripting languages that could be embedded in any application. Other languages such as Visual Basic for Applications provided strong integration with the automation facilities of an underlying system. Embedding of such general-purpose scripting languages instead of developing a new language for each application also had obvious benefits, relieving the application developer of the need to code a language translator from scratch and allowing the user to apply skills learned elsewhere.
Some software incorporates several different scripting languages. Modern web browsers typically provide a language for writing extensions to the browser itself, and several standard embedded languages for controlling the browser, including JavaScript or XUL.

Types

Scripting languages can be categorized into several different types, with a considerable degree of overlap among the types.

Glue languages

Scripting is often contrasted with system programming, as in Ousterhout's dichotomy or "programming in the large and programming in the small". In this view, scripting is glue code, connecting software components, and a language specialized for this purpose is a glue language. Pipelines and shell scripting are archetypal examples of glue languages, and Perl was initially developed to fill this same role. Web development can be considered a use of glue languages, interfacing between a database and web server. But if a substantial amount of logic is written in script, it is better characterized as simply another software component, not "glue".
Glue languages are especially useful for writing and maintaining:
  • custom commands for a command shell;
  • smaller programs than those that are better implemented in a compiled language;
  • "wrapper" programs for executables, like a batch file that moves or manipulates files and does other things with the operating system before or after running an application like a word processor, spreadsheet, data base, assembler, compiler, etc.;
  • scripts that may change;
  • Rapid application development of a solution eventually implemented in another, usually compiled, language.
Glue language examples:
Macro languages exposed to operating system or application components can serve as glue languages. These include Visual Basic for Applications, WordBasic, LotusScript, , Hummingbird Basic, QuickScript, Rexx, , and WinWrap Basic. Other tools like AWK can also be considered glue languages, as can any language implemented by a Windows Script Host engine. A majority of applications can access and use operating system components via the object models or its own functions.
Other devices like programmable calculators may also have glue languages; the operating systems of PDAs such as Windows CE may have available native or third-party macro tools that glue applications together, in addition to implementations of common glue languages—including Windows NT, DOS, and some Unix shells, Rexx, Modern Pascal, PHP, and Perl. Depending upon the OS version, WSH and the default script engines are available.
Programmable calculators can be programmed in glue languages in three ways. For example, the Texas Instruments TI-92, by factory default can be programmed with a command script language. Inclusion of the scripting and glue language Lua in the TI-NSpire series of calculators could be seen as a successor to this. The primary on-board high-level programming languages of most graphing calculators in many cases can glue together calculator functions—such as graphs, lists, matrices, etc. Third-party implementations of more comprehensive Basic version that may be closer to variants listed as glue languages in this article are available—and attempts to implement Perl, Rexx, or various operating system shells on the TI and HP graphing calculators are also mentioned. PC-based C cross-compilers for some of the TI and HP machines used with tools that convert between C and Perl, Rexx, AWK, and shell scripts to Perl, Modern Pascal, VBScript to and from Perl make it possible to write a program in a glue language for eventual implementation on the calculator.