A scripting or script language is a programming language that supports scripts. Scripts are usually short computer programs that do steps that could be done one at a time by a person. This automates a job to make it easier and more reliable. A scripting language is often a simpler language, and easier to learn than other languages, but still can do many things.
Scripts may run inside of another program, like in a web browser or Microsoft Excel. They may also be a shell that runs from a command line interface and makes calls to the operating system (OS). The shell is considered interactive - the user can choose what to type, and the shell responds to the command. These can be used to control jobs on mainframes and servers.
Examples[change | change source]
Some common examples of scripting languages:
- Bash and C shell, as control languages for the Unix or Unix-like operating systems
- Games that have scripting extensions include the Second Life virtual world and the Trainz Railroad simulators. In other games like Wesnoth, the variety of actual games played are scripts written by other users.
- Text-processing languages sed and AWK
- General purpose: Perl, Tcl, and Python are high-level programming languages (closer to human language than to machine code) that can be used for a many different things. Some of these languages were first made for a particular use, and then were changed into general-purpose languages.
Characteristics[change | change source]
Most scripting languages are made to be easy to learn. They often can be either short files with source code, or entered one command at a time in a command line interface, which has a read–eval–print loop (REPL, language shell). This usually means a simple set of commands. There might not be functions or a main, it just runs from start to finish. If something doesn't work, a programmer can make quick changes and run it again. This makes a scripting language good for making a rapid prototype to see if an idea works.
But Python allows choices - functions can be put in a file, it can be run without functions and use imperative programming style, or even use it interactively (type and run one line at a time).
print ("Hello World")
This one line of Python code prints "Hello World"; no main() function or anything else is needed.
A scripting language is usually interpreted from source code or bytecode. However, something has to run the script (interpret it) so the computer understands it. This is an application, or something in the OS. That is often written in a compiled language and distributed in machine code form (as an executable that doesn't make sense to humans).
Scripting languages may be designed to be used by the people using a program — end-user development. Other times they may be built by programmers for their own use. Scripting languages often use abstraction, a form of information hiding. This means users do not need to know the details of variable types, data storage, and memory management.
Scripts are often made or changed by the person executing them, but some are shared or sold to others. For example, when large parts of games are written in a scripting language. Sometimes a script can be compiled before others use it. Once compiled, it will run faster and doesn't need another application to run it. And this prevents end users from changing the code.
History[change | change source]
Early mainframe computers (in the 1950s) were not interactive, but used scripts stored in batch files. IBM's Job Control Language (JCL) is the common example of a scripting language used to control batch processing.
The first interactive shells were made in the 1960s to help remote operation of the first time-sharing systems. These used shell scripts, which can run computer programs within a computer program, the shell. Calvin Mooers in his TRAC language is generally given credit with inventing command substitution. This lets commands change the script (self-modifying code). 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 made from the start to be general-purpose scripting languages that could be put into any application. Other languages such as Visual Basic for Applications (VBA) could do much of the same, but needed to work only with certain applications. Using a general-purpose scripting language instead of making a new language for each application usually makes it easier for both the person writing the application and the user writing the scripts.
Types of scripting languages[change | change source]
Glue languages[change | change source]
Scripting is sometimes used to connect different applications. This is called glue code, and a language made just for this purpose is a glue language. Pipelines and shell scripting are common examples of glue languages. But if a lot of logic is written in a script file, it is better to think of it as simply another software application, 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 that do some automated things before or after running an application like a spreadsheet, data base, compiler, etc.;
- scripts that may change often;
Glue language examples:
- Unix Shell scripts (ksh, csh, bash, sh and others)
- Work Flow Language
- Windows PowerShell
Devices like programmable calculators may also have their own glue languages. For example, the Texas Instruments TI-92, by factory default can be programmed with a command script language. The TI-NSpire calculator understands the Lua language. Others understand some kind of Basic language, or maybe Lisp or something else.
Job control languages and shells[change | change source]
This group has come from the automation of job control, which relates to starting and controlling the behavior of system programs, starting from IBM's JCL. Many of these languages' interpreters also work as command-line interpreters such as the Unix shell or the MS-DOS
COMMAND.COM. Others, such as AppleScript offer the use of English-like commands to build scripts.
GUI scripting[change | change source]
When building graphical user interfaces, a way of testing it is needed. Specialized scripting languages were made to control graphic windows, menus, buttons, and so on just like a human user would. Many times, these can be used to copy exactly what a person does (moving a mouse, clicking or typing on a keyboard). This action or set of actions that is copied and remembered is called a macro.
Application-specific languages[change | change source]
Many large applications include a scripting language built just for that application. The application can be a game or a business program. This type of language is made for a single application. They make look like a general-purpose language (e.g. QuakeC, modeled after C), they have custom features that distinguish them.
Extension/embeddable languages[change | change source]
This is like an application-specific scripting languages, in that it controls an application, but the language can be used in many applications.
Some languages shift from one type to another over time, usually as they add capability to do more things.
References[change | change source]
- Sheppard, Doug (2000-10-16). "Beginner's Introduction to Perl". dev.perl.org. http://www.perl.com/pub/2000/10/begperl1.html. Retrieved 2011-01-08.
- Programming is Hard, Let's Go Scripting…, Larry Wall, December 6, 2007
- Hey, Tony; Pápay, Gyuri (2014). The Computing Universe: A Journey through a Revolution. Cambridge University Press. p. 76. ISBN 978-1-31612322-5, "A major characteristic of modern scripting languages is their interactivity, sometimes referred to as a REPL programming environment. […] The characteristics of ease of use and immediate execution with a REPL environment are sometimes taken as the definition of a scripting language."
- Brown, Vicki. "Scripting Languages". http://www.mactech.com/articles/mactech/Vol.15/15.09/ScriptingLanguages/index.html. Retrieved 2009-07-22.
- Loui, Ronald (2008). "In praise of scripting". IEEE Computer. http://www.cse.wustl.edu/~loui/praiseieee.html.
- IBM Corporation (1967). IBM System/360 Operating System Job Control Language (C28-6529-4). http://www.bitsavers.org/pdf/ibm/360/os/R01-08/C28-6539-4_OS_JCL_Mar67.pdf.
- Mooers, Calvin. "TRAC, A Procedure-Describing Language for the Reactive Typewriter". Archived from the original on 2001-04-25. https://web.archive.org/web/20010425014914/http://tracfoundation.org/trac64/procedure.htm. Retrieved March 9, 2012.
- Van Vleck(ed.), Thomas. "Multics Glossary -A- (active function)". http://www.multicians.org/mga.html. Retrieved March 9, 2012.
- Varian, Melinda. "VM AND THE VM COMMUNITY: Past, Present, and Future". http://web.me.com/melinda.varian/Site/Melinda_Varians_Home_Page_files/neuvm.pdf. Retrieved March 9, 2012.
- Van Vleck, Thomas(ed.). "Multics Glossary -R- (RUNCOM)". http://www.multicians.org/mgr.html#runcom. Retrieved March 9, 2012.