Misplaced Pages

Scripting language: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editContent deleted Content addedVisualWikitext
Revision as of 19:03, 19 September 2007 edit80.187.98.1 (talk)No edit summary← Previous edit Latest revision as of 05:15, 28 December 2024 edit undoMeters (talk | contribs)Extended confirmed users, New page reviewers, Pending changes reviewers, Rollbackers172,797 editsm Reverted edit by 38.9.240.35 (talk) to last version by Tule-hogTag: Rollback 
Line 1: Line 1:
{{Short description|Programming language designed for scripting}}
:''Scripting redirects here. For other uses, see ].''
{{more inline citations needed|date=August 2024}}
] 3.4]]
In computing, a '''script''' is a relatively short and simple set of instructions that typically ] an otherwise manual process. The act of writing a script is called '''scripting'''. A '''scripting language''' or '''script language''' is a ] that is used for scripting.<ref name="ecma262">{{cite web |url=https://tc39.github.io/ecma262/#sec-overview |title=ECMAScript 2019 Language Specification |access-date=2018-04-02 |publisher=Ecma International}}</ref>


Originally, scripting was limited to automating an ] and languages were relatively simple. Today, scripting is more pervasive and some languages include modern features that allow them to be used for ] development as well as scripting.
'''Scripting languages''' (commonly called '''scripting programming languages''' or '''script languages''') are computer ]s that are typically ] and can be typed directly from a keyboard. Thus, scripts are often distinguished from ''programs,'' because programs are converted permanently into ] ] (i.e. machine code) before they are run (There are some interpreters which convert the script into some suitable binary form, for efficiency reasons, but this is transparent to the user). Scripts remain in their original form and are interpreted command-by-command each time they are run.<ref>"scripting language" ''A Dictionary of Computing''. (Oxford University Press, 2004) Oxford Reference Online <http://www.oxfordreference.com/views/ENTRY.html?subview=Main&entry=t11.e4636></ref><ref>"CGI (Common Gateway Interface)." World of Computer Science. Ed. Brigham Narins. (Detroit: Gale, 2002) Science Resource Center. <http://0-galenet.galegroup.com.sable.jefferson.lib.co.us:80/servlet/SciRC?ste=1&docNum=CV2424500109></ref> Scripts were created to shorten the traditional edit-]-]-run process. The name 'script' is derived from the written script of the ], in which dialogue is set down to be interpreted by actors and actresses--the programs. Early script languages were often called ''batch languages'' or ''job control languages''. Scripting languages can also be compiled, but because interpreters are simpler to write than compilers, they are interpreted more often than they are compiled.


==Overview==
The term ''scripting language'' is not technical, though embedding and dependence on a larger system are usually criteria. In computer games, scripts extend game logic, tailoring the ] to particular game data. Scripts also make applications programmable from within, so that repetitive tasks can be quickly automated. Of course, not every scripting system that grows beyond its original design and delegation acquires a new name. Full-blown in-game languages such as ] exist, and ] is a very influential standard, supported by virtually every browser on the market.


A scripting language can be a general purpose language or a ] for a particular environment.
==Description==
When embedded in an application, it may be called an '''extension language'''.
] are created for varying purposes and tasks &mdash; different kinds and styles of programming. One common programming task is known as '''scripting''', or connecting diverse pre-existing components to accomplish a new related task. Those languages which are suited to scripting are typically called '''scripting languages'''. Many languages for this purpose have common properties: they favor rapid development over efficiency of execution; they are normally implemented with ]s rather than ]s; and they are strong at communicating with program components written in other languages.


A scripting language is sometimes referred to as ] if it operates at a high level of abstraction, or as a '''control language''', particularly for job control languages on mainframes.
Many scripting languages emerged as tools for executing one-off tasks, particularly in ]. One way of looking at scripts is as "glue" that puts several components together; thus they are widely used for creating ]s or executing a series of commands that might otherwise have to be entered interactively through keyboard at the ]. The ] usually offers some type of scripting language by default, widely known as a ] language.


The term ''scripting language'' is sometimes used in a wider sense, to refer to ] ] programming languages in general. Some are strictly ]s, while others use a form of compilation.
Other scripting languages are oriented toward empowering end users to write and debug short, simple, and possibly domain-specific programs. The primary aim of the scripting language is to insulate the user from the intricacies of more formal development and from usage of programming tools developed for an entirely different class of developer. Another aim of the scripting language is to make it easy for a user with domain knowledge (an engineer, statistician, economist, etc.) to accomplish given tasks.
In this context, the term ''script'' refers to a small program in such a language; typically, 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 ] to ]s. 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.
Scripts are typically stored only in their plain text form (as ]) and ], or ] each time prior to being invoked.


==Notable languages==
Some scripting languages are designed for a specific domain, but often it is possible to write more general programs in that language. In many large-scale projects, a scripting language and a lower level programming language are used together, each lending its particular strengths to solve specific problems. Scripting languages are often designed for interactive use, having many commands that can execute individually, and often have very ] operations (for example, in the classic ], most operations are programs themselves).


{{Seealso|List of scripting languages}}
Such high level commands simplify the process of writing code. Programming features such as ] and ] can be taken for granted. In a 'lower level' or non-scripting language, managing memory and variables, and creating data structures tends to consume more programmer effort and lines of code to complete a given task. In some situations, this is well worth it for the resulting fine-grained control. The scripter typically has less flexibility to optimize a program for speed or to conserve memory.


* ], for text-processing, generally available in Unix-like operating systems
For the reasons noted above, it is usually faster to program in a scripting language, and script files are typically much smaller than, for example, equivalent C program files. The flip side can be a performance penalty: scripting languages, often interpreted, may be significantly slower to execute and might consume more memory when running. In some cases, however, e.g. with small scripts of some tens of lines, the write-time advantage far outweighs the run-time disadvantage. Also, this argument gets stronger with rising programmer salaries and falling hardware costs.
* ], interpreted language for scripting ] and ] ]s
* ], ]-like, object-oriented scripting
* ] (later: ]), originally limited to running in a web browser to dynamically modify a web page; later enhanced into a widely portable, general-purpose programming language
* ], custom, extension language for scripting ] ]
* ], family of general-purpose and extension languages for applications including ] for ]
* ], extension language used by many applications
* ],<ref name="sheppard00">{{cite web |url=http://www.perl.com/pub/2000/10/begperl1.html |title=Beginner's Introduction to Perl |access-date=2011-01-08 |last=Sheppard |first=Doug |date=2000-10-16 |publisher=Perl.com}}</ref> text-processing language that later developed into a general-purpose language; also used as an extension language for various applications
* ], for scripting ], ] and ]
* ], general-purpose as well as extension language
* ], general-purpose language that runs on many platforms; also used as extension language
* ], multiple-paradigm, general-purpose language
* ], for text-processing; available in most Unix-like operating systems and ported to other operating systems
* ],<ref>{{Cite web |date=2007-12-12 |title=Programming is Hard, Let's Go Scripting... |url=http://www.perl.com/pub/2007/12/06/soto-11.html |first1=Larry |last1=Wall |author-link1=Larry Wall |website=Perl.com |language=en-us |url-status=live |archive-url=https://web.archive.org/web/20231208163227/https://www.perl.com/pub/2007/12/06/soto-11.html/ |archive-date=December 8, 2023}}</ref> for Unix-like environments, popular in the 1990s; can be used in conjunction with ] to develop GUI applications
* TrainzScript, custom, extension language for ] railroad simulators
* ], for scripting ]
* ] (VBA), an extension language available in ] applications


==Characteristics==
However, the boundary between scripting languages and regular programming languages tends to be vague, and is blurring ever more with the emergence of new languages and integrations in this fast-changing area. In some scripting languages, an experienced programmer can accomplish a good deal of optimization if they choose. And, in general, it is possible to write a script in any language (including ] or ]). This is not recommended, however, for scripting languages whose interpreters are to be marketed, such as languages for macros or for web development.


Script is a subjective characterization that generally includes the following attributes.
==Types of scripting languages==
===Job control languages and shells===
{{main|Shell script}}


===Interpreted===
A major class of scripting languages has grown out of the automation of job control, which relates to starting and controlling the behavior of system programs. Many of these languages' interpreters double as ]s such as the Unix shell or the MS-DOS COMMAND.COM. Others, such as AppleScript, add scripting capability to computing environments lacking a command-line interface.


A script is usually not ] {{endash}} at least not its usual meaning. Generally, they are ] directly from ] or from ] or run as native after ].<ref>{{cite web |last1=Brown |first1=Vicki |first2=Rich |last2=Morin |title=Scripting Languages |url=http://www.mactech.com/articles/mactech/Vol.15/15.09/ScriptingLanguages/ |access-date=2009-07-22 |website=MacTech |date=1999 |language=en-US}}
*]
</ref>
*]
*] (Amiga Rexx)
*]
*]
*] (C Compatible shell)
*] (on OpenVMS)
*]
*] via ]
*]
*] (], ], ])
*] (], ])
*]
*]
*]
*]
*] via ]
*]
*]
*]
*]


===GUI Scripting=== ===Short & simple===
With the advent of ]s came a specialized kind of scripting language for controlling a computer. These languages interact with the same graphic windows, menus, buttons, and so on that a system generates. These languages are typically used to automate repetitive actions or configure a standard state. In principle, they could be used to control any application running on a GUI-based computer; but, in practice, the support for such languages depend on the application and ]. Such languages are also called "]" when control is through keyboard interaction.


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 ] of multiple files, that performs sophisticated ] or ] interface or complicated ]s or ] is probably not considered a script.
*]
*]
*
*]
*]


===Automates===
===Application-specific languages===
Many large application programs include an idiomatic scripting language tailored to the needs of the application user. Likewise, many ] systems use a custom scripting language to express the programmed actions of ]s and the game environment. Languages of this sort are designed for a single application; and, while they may superficially resemble a specific general-purpose language (e.g. QuakeC, modeled after C), they have custom features that distinguish them.


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


===Limited language===
===Web programming languages===
An important type of application-specific scripting language is one used to provide custom functionality to ]s. Such languages are specialized for ] and other Internet uses. <!-- communication and use web browsers for their user interface = client-side Javascript? But examples are server-side... --> However, most modern web programming languages are powerful enough for general-purpose programming.


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 ].
===Text processing languages===
The processing of text-based records is one of the oldest uses of scripting languages. Many, such as ]'s awk and, later, Perl, were originally designed to aid ]s in automating tasks that involved Unix text-based configuration and log files. Perl is a special case -- originally intended as a report-generation language, it has grown into a full-fledged applications language in its own right.


For example, ] is not script-like since an application starts at the function named {{code|main}} which need not be at the top of the code. The following code starts at {{code|main}}, then calls {{code|printHelloWorld}} which prints "Hello World".
*]
*]
*]
*]


<syntaxhighlight lang="java">
===General-purpose dynamic languages===
public class HelloWorld {
public static void printHelloWorld() {
System.out.println("Hello World");
}
public static void main(String args) {
printHelloWorld();
}
}
</syntaxhighlight>


In contrast, the following ] code prints "Hello World" without the {{code|main}} function or other syntax such as a class definition required by Java.
Some languages, such as Perl, began as scripting languages but were developed into programming languages suitable for broader purposes. Other similar languages -- frequently interpreted, memory-managed, or ] -- have been described as "scripting languages" for these similarities, even if they are more commonly used for applications programming. They are usually ''not'' called "scripting languages" by their own users.


<syntaxhighlight lang="python">
*]
print("Hello World")
*]
</syntaxhighlight>
*]
*]
*]
*]
*]
*]
*] (M)
*]
*]
*]
*]
*]
*]
*]
*]
*]
*] (Tool command language)
*]


===Single user===
===Extension/embeddable languages===


Scripts are often created or modified by the person executing them,<ref>{{cite web|publisher=IEEE Computer |url=http://www.cse.wustl.edu/~loui/praiseieee.html|title=In Praise of Scripting: Real Programming Pragmatism |first=Ronald|last=Loui|access-date=2013-08-27|archive-url=https://web.archive.org/web/20150923211452/http://www.cse.wustl.edu/~loui/praiseieee.html|archive-date=2015-09-23|url-status=dead}}</ref> but they are also often distributed, such as when large portions of games are written in a scripting language, notably the ] T-rex game.
A number of languages have been designed for the purpose of replacing application-specific scripting languages by being embeddable in application programs. The application programmer (working in C or another systems language) includes "hooks" where the scripting language can control the application. These languages serve the same purpose as application-specific extension languages but with the advantage of allowing some transfer of skills from application to application.


==History==
*] (C/C++ interpreter)
Early ]s (in the 1950s) were non-interactive, instead using ]. IBM's ] (JCL) is the archetype of languages used to control batch processing.<ref>{{cite book|last=IBM Corporation|title=IBM System/360 Operating System Job Control Language (C28-6529-4)|date=March 1967|url=http://www.bitsavers.org/pdf/ibm/360/os/R01-08/C28-6539-4_OS_JCL_Mar67.pdf |via=bitsavers |url-status=live |archive-url=https://web.archive.org/web/20230525192103/http://www.bitsavers.org/pdf/ibm/360/os/R01-08/C28-6539-4_OS_JCL_Mar67.pdf |archive-date=May 25, 2023}}</ref>
*] a.k.a. ], ], ]
*]
*
*]
*]
*]
*]
*]
*]
*]
*] (REALbasic Script)
*]
*]
*]
*]


The first interactive ]s were developed in the 1960s to enable remote operation of the first ] systems, and these used ], which controlled running computer programs within a computer program, the shell. ] in his ] 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.<ref>{{cite web|last=Mooers|first=Calvin|title=TRAC, A Procedure-Describing Language for the Reactive Typewriter|url=http://tracfoundation.org/trac64/procedure.htm |date=1965 |website=TRAC Foundation |archive-url=https://web.archive.org/web/20010425014914/http://tracfoundation.org/trac64/procedure.htm|archive-date=2001-04-25|access-date=March 9, 2012}}</ref> ] calls these ''active functions''.<ref>{{cite web |editor-last=Van Vleck |editor-first=Thomas |title=Multics Glossary – A — (active function) |url=http://www.multicians.org/mga.html |website=Multics |access-date=March 9, 2012}}</ref>
JavaScript began as and primarily still is a language for scripting inside of ]s; however, the standardization of the language as ] has made it popular as a general purpose embeddable language. In particular, the ] implementation ] is embedded in several environments such as the ]. Other applications embedding ECMAScript implementations include the ] products ] (]) and ] (for scripting ] files).
] wrote an early processor for command scripts called RUNCOM for ] around 1964. ] at MIT wrote a scripting language for IBM's ] in 1966. He originally called this processor COMMAND, later named ].<ref>{{cite web|last=Varian|first=Melinda|title=VM and the VM Community: Past, Present, and Future|url=http://web.me.com/melinda.varian/Site/Melinda_Varians_Home_Page_files/neuvm.pdf |date=April 1991 |access-date=March 9, 2012 |url-status=dead |archive-url=https://web.archive.org/web/20111006064701/http://web.me.com/melinda.varian/Site/Melinda_Varians_Home_Page_files/neuvm.pdf |archive-date=October 6, 2011}}</ref> Multics included an offshoot of CTSS RUNCOM, also called RUNCOM.<ref>{{cite web |editor-last=Van Vleck |editor-first=Thomas |title=Multics Glossary – R — (RUNCOM) |url=http://www.multicians.org/mgr.html#runcom |access-date=March 9, 2012}}</ref> ] was eventually replaced by ] and ].


Languages such as ] and ] were specifically designed as general-purpose scripting languages that could be embedded in any application. Other languages such as ] (VBA) 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.
Tcl was created as an extension language but has come to be used more frequently as a general purpose language in roles similar to Python, Perl, and Ruby.


Some software incorporates several different scripting languages. Modern ]s typically provide a language for writing extensions to the browser itself, and several standard embedded languages for controlling the browser, including ] (a dialect of ]) or ].
===Others===
*]
*]
*]
*] (server side scripting)
*]
*]
*]
*]
*]
*]
*]
*]
*]
*]
*]
*]
*]
*]
*]
*]
*]
*]
*]


==See also== ==Types==
Scripting languages can be categorized into several different types, with a considerable degree of overlap among the types.
*]
*]
*] and ] languages
*]
*]
*]


===Glue languages===
Scripting is often contrasted with ], as in ] or "]". In this view, scripting is ], connecting ]s, and a language specialized for this purpose is a ''glue language''. Pipelines and shell scripting are archetypal examples of glue languages, and ] was initially developed to fill this same role. ] can be considered a use of glue languages, interfacing between a ] and ]. 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;<ref>{{Cite web|title=What is glue code (glue code language)? - Definition from WhatIs.com|url=https://whatis.techtarget.com/definition/glue-code|access-date=2022-01-31|website=WhatIs.com|language=en}}</ref>
* smaller programs than those that are better implemented in a compiled language;<ref>{{Cite web|last=Larson|first=Quincy|title=Interpreted vs Compiled Programming Languages|url=https://www.freecodecamp.org/news/compiled-versus-interpreted-languages/|access-date=23 February 2022|website=Free Code Camp|date=10 January 2020}}</ref>
* "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.;<ref>{{Cite web|last=Balkis|first=Anton|title=Script Adalah|url=https://rajatips.com/script/|access-date=23 February 2022|website=Raja Tips}}</ref>
* scripts that may change;<ref>{{Cite web|last=Axelsson|first=Mats|title=Shell scripts - What can you change|url=https://linuxhint.com/customize_shell_scripts/|access-date=23 February 2022|website=Linux Hint}}</ref>
* ] of a solution eventually implemented in another, usually compiled, language.{{Citation needed|date=January 2022}}

Glue language examples:
{{div col|colwidth=18em}}
* ]
* ]
* ]
* ]
* ]
* ]
* ], ]
* ]
* ]
* ]
* ], ]
* ]
* ]
* ] (5 and ])
* ]
* ]
* ]
* ]
* ]
* ]
* ]
* ]
* ]
* ]
* ]
* ] ]s (], ], ], ] and others)
* ]
* ]
* ]
{{Div col end}}
] languages exposed to operating system or application components can serve as glue languages. These include ], ], ], , Hummingbird Basic, QuickScript, Rexx, , and WinWrap Basic. Other tools like ] can also be considered glue languages, as can any language implemented by a ] engine (VBScript, JScript and VBA by default in Windows and third-party engines including implementations of Rexx, Perl, Tcl, Python, XSLT, Ruby, Modern Pascal, ], and C). A majority of applications can access and use operating system components via the ]s 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 ], ], and some ]s, Rexx, Modern Pascal, PHP, and Perl. Depending upon the OS version, WSH and the default script engines (VBScript and JScript) are available.

Programmable calculators can be programmed in glue languages in three ways. For example, the ] ], by factory default can be programmed with a command script language. Inclusion of the scripting and glue language ] in the ] series of calculators could be seen as a successor to this. The primary on-board high-level programming languages of most graphing calculators (most often Basic variants, sometimes Lisp derivatives, and more uncommonly, C derivatives) 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 ] 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 (as a compiled program) on the calculator.{{Citation needed|date=October 2021}}

===Editor languages===
A number of text editors support macros written either using a macro language built into the editor, e.g., ] (TSE), ] (VIM), or using an external implementation, e.g., ], or both, e.g., ]. Sometimes text editors and edit macros are used under the covers to provide other applications, e.g., FILELIST and RDRLIST in ] .

===Job control languages and shells===
{{Main|Shell script}}
A major class of scripting languages has grown out of the automation of ], which relates to starting and controlling the behavior of system programs<ref>{{Cite web |title=Job Control Basics (Bash Reference Manual) |url=https://www.gnu.org/software/bash/manual/html_node/Job-Control-Basics.html |access-date=2022-05-20 |website=GNU}}</ref> (in this sense, one might think of shells as being descendants of IBM's JCL, or ], which was used for exactly this purpose). Many of these languages' interpreters double as ]s such as the ] or the MS-DOS <code>]</code>. Others, such as ] offer the use of English-like commands to build scripts.

===GUI scripting===
With the advent of graphical user interfaces, a specialized kind of scripting language emerged for controlling a computer. These languages interact with the same graphic windows, menus, buttons, and so on, that a human user would. They do this by simulating the actions of a user. These languages are typically used to automate user actions. Such languages are also called "]" when control is through simulated key presses or mouse clicks, as well as tapping or pressing on a touch-activated screen.

These languages could in principle be used to control any GUI application; but, in practice their use is limited because their use needs support from the application and from the ]. There are a few exceptions to this limitation. Some GUI scripting languages are based on recognizing graphical objects from their display screen ]s. These GUI scripting languages do not depend on support from the operating system or application.

When the GUI provides the appropriate interfaces, as in the IBM ], a generic scripting language, e.g. ], can be used for writing GUI scripts.
<!-- It would be nice to three or four other examples, with references or wikilinks. -->

===Application-specific languages===
Application specific languages can be split in many different categories, i.e. standalone based app languages (executable) or internal application specific languages (postscript, xml, gscript as some of the widely distributed scripts, respectively implemented by Adobe, MS and Google) among others include an idiomatic scripting language tailored to the needs of the application user. Likewise, many ] systems use a custom scripting language to express the programmed actions of ]s and the game environment. Languages of this sort are designed for a single application; and, while they may superficially resemble a specific general-purpose language (e.g. ], modeled after C), they have custom features that distinguish them. ], while a fully formed and capable dialect of ], contains many special features that make it most useful for extending the editing functions of Emacs. An application-specific scripting language can be viewed as a ] specialized to a single application.

===Extension/embeddable languages===
<!-- {{Main|Extensible Embeddable Language}} refers to a specific language, not the concept -->
A number of languages have been designed for the purpose of replacing application-specific scripting languages by being embeddable in application programs. The application programmer (working in C or another systems language) includes "hooks" where the scripting language can control the application. These languages may be technically equivalent to an application-specific extension language but when an application embeds a "common" language, the user gets the advantage of being able to transfer skills from application to application. A more generic alternative is simply to provide a library (often a C library) that a general-purpose language can use to control the application, without modifying the language for the specific domain.

JavaScript began as and primarily still is a language for scripting inside ]s; however, the standardization of the language as ] has made it popular as a general-purpose embeddable language. In particular, the ] implementation ] is embedded in several environments such as the ]. Other applications embedding ECMAScript implementations include the ] products ] (]) and ] (for scripting ] files).

] was created as an extension language but has come to be used more frequently as a general-purpose language in roles similar to ], ], and ]. On the other hand, ] was originally created as a job control language, but is widely used as an extension language as well as a general-purpose language. Perl is a general-purpose language, but had the Oraperl (1990) dialect, consisting of a ] 4 binary with ] compiled in. This has however since been replaced by a library (Perl Module), .<ref>" Perl access to Oracle databases for old oraperl scripts]", metacpan.</ref><ref>"", ''Underground Oracle FAQ''.</ref>

Other complex and task-oriented applications may incorporate and expose an embedded programming language to allow their users more control and give them more functionality than can be available through a user interface, no matter how sophisticated. For example, ] 3D authoring tools embed the ], or ] which uses ] to fill this role.

Some other types of applications that need faster feature addition or tweak-and-run cycles (e.g. ]) also use an embedded language. During the development, this allows them to prototype features faster and tweak more freely, without the need for the user to have intimate knowledge of the inner workings of the application or to rebuild it after each tweak (which can take a significant amount of time). The scripting languages used for this purpose range from the more common and more famous ] and ] to lesser-known ones such as ] and ].

==See also==
* ]
* ]
* ]<ref>{{Cite web|url=https://www.python.org/doc/essays/omg-darpa-mcc-position/|title=Glue It All Together With Python |last=van Rossum|first=Guido|date=January 6–8, 1998 |publisher=python.org |url-status=live |archive-url=https://web.archive.org/web/20240119041124/https://www.python.org/doc/essays/omg-darpa-mcc-position/ |archive-date= Jan 19, 2024 }}</ref>
* ]
* ], ]
* ]


==References== ==References==
{{Reflist}}
<div class="references-small">
<references/>
</div>


==External links== ==Further reading==
* {{cite book
* &ndash; from The Scriptometer.
|last=Barron
* by Dr. Nikolai Bezroukov
|first=David William
* by John K. Ousterhout
|year=2001
* &mdash; 2003 study
|title=The World of Scripting Languages
|publisher=Wiley
|isbn=0-471-99886-9}}


==External links==
{{Programming language}}
{{Commons category|Scripting languages}}
*{{webarchive |url=https://web.archive.org/web/20041010125419/http://www.doc.ic.ac.uk/~np2/patterns/scripting/ |date=October 10, 2004 |title=Patterns for Scripted Applications}}


{{Programming paradigms navbox}}
]
<!--]--> {{Types of programming languages}}
{{Authority control}}


{{DEFAULTSORT:Scripting Language}}
]
]
]
]
]
<!-- Hidden categories below -->
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]

Latest revision as of 05:15, 28 December 2024

Programming language designed for scripting
This article includes a list of general references, but it lacks sufficient corresponding inline citations. Please help to improve this article by introducing more precise citations. (August 2024) (Learn how and when to remove this message)
GDScript in Godot 3.4

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 an operating system shell and languages were relatively simple. Today, scripting is more pervasive and some languages include modern features that allow them to be used for application development as well as scripting.

Overview

A scripting language can be a general purpose language or a domain-specific language for a particular 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, particularly for job control languages on mainframes.

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, 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

See also: List of scripting languages
  • AWK, for text-processing, generally available in Unix-like operating systems
  • Bash, interpreted language for scripting Unix and Unix-like operating systems
  • Groovy, Java-like, object-oriented scripting
  • JavaScript (later: ECMAScript), originally limited to running in a web browser to dynamically modify a web page; later enhanced into a widely portable, general-purpose programming language
  • Linden Scripting Language, custom, extension language for scripting Second Life virtual world
  • Lisp, family of general-purpose and extension languages for applications including Emacs Lisp for Emacs
  • Lua, extension language used by many applications
  • Perl, text-processing language that later developed into a general-purpose language; also used as an extension language for various applications
  • PowerShell, for scripting Microsoft Windows, macOS and Linux
  • Python, general-purpose as well as extension language
  • Rexx, general-purpose language that runs on many platforms; also used as extension language
  • Ruby, multiple-paradigm, general-purpose language
  • sed, for text-processing; available in most Unix-like operating systems and ported to other operating systems
  • Tcl, for Unix-like environments, popular in the 1990s; can be used in conjunction with Tk to develop GUI applications
  • TrainzScript, custom, extension language for Trainz railroad simulators
  • VBScript, for scripting Microsoft Windows
  • Visual Basic for Applications (VBA), an extension language available in Microsoft Office applications

Characteristics

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 main which need not be at the top of the code. The following code starts at main, then calls printHelloWorld which prints "Hello World".

public class HelloWorld {
    public static void printHelloWorld() {
        System.out.println("Hello World");
    }
    public static void main(String args) {
        printHelloWorld();
    }
}

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

print("Hello World")

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 (in the 1950s) were non-interactive, instead using batch processing. IBM's Job Control Language (JCL) 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 (VBA) 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 (a dialect of ECMAScript) 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, CorelScript, Hummingbird Basic, QuickScript, Rexx, SaxBasic, and WinWrap Basic. Other tools like AWK can also be considered glue languages, as can any language implemented by a Windows Script Host engine (VBScript, JScript and VBA by default in Windows and third-party engines including implementations of Rexx, Perl, Tcl, Python, XSLT, Ruby, Modern Pascal, Delphi, and C). 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 (VBScript and JScript) 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 (most often Basic variants, sometimes Lisp derivatives, and more uncommonly, C derivatives) 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 (as a compiled program) on the calculator.

Editor languages

A number of text editors support macros written either using a macro language built into the editor, e.g., The SemWare Editor (TSE), vi improved (VIM), or using an external implementation, e.g., XEDIT, or both, e.g., KEDIT. Sometimes text editors and edit macros are used under the covers to provide other applications, e.g., FILELIST and RDRLIST in CMS .

Job control languages and shells

Main article: Shell script

A major class of scripting languages has grown out of the automation of job control, which relates to starting and controlling the behavior of system programs (in this sense, one might think of shells as being descendants of IBM's JCL, or Job Control Language, which was used for exactly this purpose). Many of these languages' interpreters double 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

With the advent of graphical user interfaces, a specialized kind of scripting language emerged for controlling a computer. These languages interact with the same graphic windows, menus, buttons, and so on, that a human user would. They do this by simulating the actions of a user. These languages are typically used to automate user actions. Such languages are also called "macros" when control is through simulated key presses or mouse clicks, as well as tapping or pressing on a touch-activated screen.

These languages could in principle be used to control any GUI application; but, in practice their use is limited because their use needs support from the application and from the operating system. There are a few exceptions to this limitation. Some GUI scripting languages are based on recognizing graphical objects from their display screen pixels. These GUI scripting languages do not depend on support from the operating system or application.

When the GUI provides the appropriate interfaces, as in the IBM Workplace Shell, a generic scripting language, e.g. OREXX, can be used for writing GUI scripts.

Application-specific languages

Application specific languages can be split in many different categories, i.e. standalone based app languages (executable) or internal application specific languages (postscript, xml, gscript as some of the widely distributed scripts, respectively implemented by Adobe, MS and Google) among others include an idiomatic scripting language tailored to the needs of the application user. Likewise, many computer game systems use a custom scripting language to express the programmed actions of non-player characters and the game environment. Languages of this sort are designed for a single application; and, while they may superficially resemble a specific general-purpose language (e.g. QuakeC, modeled after C), they have custom features that distinguish them. Emacs Lisp, while a fully formed and capable dialect of Lisp, contains many special features that make it most useful for extending the editing functions of Emacs. An application-specific scripting language can be viewed as a domain-specific programming language specialized to a single application.

Extension/embeddable languages

A number of languages have been designed for the purpose of replacing application-specific scripting languages by being embeddable in application programs. The application programmer (working in C or another systems language) includes "hooks" where the scripting language can control the application. These languages may be technically equivalent to an application-specific extension language but when an application embeds a "common" language, the user gets the advantage of being able to transfer skills from application to application. A more generic alternative is simply to provide a library (often a C library) that a general-purpose language can use to control the application, without modifying the language for the specific domain.

JavaScript began as and primarily still is a language for scripting inside web browsers; however, the standardization of the language as ECMAScript has made it popular as a general-purpose embeddable language. In particular, the Mozilla implementation SpiderMonkey is embedded in several environments such as the Yahoo! Widget Engine. Other applications embedding ECMAScript implementations include the Adobe products Adobe Flash (ActionScript) and Adobe Acrobat (for scripting PDF files).

Tcl was created as an extension language but has come to be used more frequently as a general-purpose language in roles similar to Python, Perl, and Ruby. On the other hand, Rexx was originally created as a job control language, but is widely used as an extension language as well as a general-purpose language. Perl is a general-purpose language, but had the Oraperl (1990) dialect, consisting of a Perl 4 binary with Oracle Call Interface compiled in. This has however since been replaced by a library (Perl Module), DBD::Oracle.

Other complex and task-oriented applications may incorporate and expose an embedded programming language to allow their users more control and give them more functionality than can be available through a user interface, no matter how sophisticated. For example, Autodesk Maya 3D authoring tools embed the Maya Embedded Language, or Blender which uses Python to fill this role.

Some other types of applications that need faster feature addition or tweak-and-run cycles (e.g. game engines) also use an embedded language. During the development, this allows them to prototype features faster and tweak more freely, without the need for the user to have intimate knowledge of the inner workings of the application or to rebuild it after each tweak (which can take a significant amount of time). The scripting languages used for this purpose range from the more common and more famous Lua and Python to lesser-known ones such as AngelScript and Squirrel.

See also

References

  1. "ECMAScript 2019 Language Specification". Ecma International. Retrieved 2018-04-02.
  2. Sheppard, Doug (2000-10-16). "Beginner's Introduction to Perl". Perl.com. Retrieved 2011-01-08.
  3. Wall, Larry (2007-12-12). "Programming is Hard, Let's Go Scripting..." Perl.com. Archived from the original on December 8, 2023.
  4. Brown, Vicki; Morin, Rich (1999). "Scripting Languages". MacTech. Retrieved 2009-07-22.
  5. Loui, Ronald. "In Praise of Scripting: Real Programming Pragmatism". IEEE Computer. Archived from the original on 2015-09-23. Retrieved 2013-08-27.
  6. IBM Corporation (March 1967). IBM System/360 Operating System Job Control Language (C28-6529-4) (PDF). Archived (PDF) from the original on May 25, 2023 – via bitsavers.
  7. Mooers, Calvin (1965). "TRAC, A Procedure-Describing Language for the Reactive Typewriter". TRAC Foundation. Archived from the original on 2001-04-25. Retrieved March 9, 2012.
  8. Van Vleck, Thomas (ed.). "Multics Glossary – A — (active function)". Multics. Retrieved March 9, 2012.
  9. Varian, Melinda (April 1991). "VM and the VM Community: Past, Present, and Future" (PDF). Archived from the original (PDF) on October 6, 2011. Retrieved March 9, 2012.
  10. Van Vleck, Thomas (ed.). "Multics Glossary – R — (RUNCOM)". Retrieved March 9, 2012.
  11. "What is glue code (glue code language)? - Definition from WhatIs.com". WhatIs.com. Retrieved 2022-01-31.
  12. Larson, Quincy (10 January 2020). "Interpreted vs Compiled Programming Languages". Free Code Camp. Retrieved 23 February 2022.
  13. Balkis, Anton. "Script Adalah". Raja Tips. Retrieved 23 February 2022.
  14. Axelsson, Mats. "Shell scripts - What can you change". Linux Hint. Retrieved 23 February 2022.
  15. "Job Control Basics (Bash Reference Manual)". GNU. Retrieved 2022-05-20.
  16. "Oraperl - ", metacpan.
  17. "Perl", Underground Oracle FAQ.
  18. van Rossum, Guido (January 6–8, 1998). "Glue It All Together With Python". python.org. Archived from the original on Jan 19, 2024.

Further reading

  • Barron, David William (2001). The World of Scripting Languages. Wiley. ISBN 0-471-99886-9.

External links

Programming paradigms (Comparison by language)
Imperative
Structured
Object-oriented
(comparison, list)
Declarative
Functional
(comparison)
Dataflow
Logic
DSL
Concurrent,
distributed,
parallel
Metaprogramming
Separation
of concerns
Types of programming languages
Level
Generation
Categories: