Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Scripting language

From Wikipedia, the free encyclopedia
Programming language designed for scripting
This article includes a list ofgeneral references, butit lacks sufficient correspondinginline citations. Please help toimprove this article byintroducing more precise citations.(August 2024) (Learn how and when to remove this message)
GDScript inGodot 3.4

In computing, ascript is a relatively short and simple set of instructions that typicallyautomate an otherwise manual process. The act of writing a script is calledscripting. Ascripting language orscript language is aprogramming language that is used for scripting.[1]

Originally, scripting was limited to automatingshells inoperating 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 developapplication software also.

Overview

[edit]

A scripting language can be ageneral-purpose programming language or adomain-specific language for a given environment. When embedded in an application, it may be called anextension language.

A scripting language is sometimes referred to asvery high-level programming language if it operates at a high level of abstraction, or as acontrol language, especially for job control languages onmainframe computers.

The termscripting language is sometimes used in a wider sense, to refer todynamichigh-level programming languages in general. Some are strictlyinterpreted languages, while others use a form of compilation.In this context, the termscript 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 highlydomain-specific language togeneral-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-specificdialects.

Notable languages

[edit]
See also:List of scripting languages

Characteristics

[edit]

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

Interpreted

[edit]

A script is usually notcompiled, at least not its usual meaning. Generally, they areinterpreted directly fromsource code, or frombytecode, or run as native afterjust-in-time compilation.[5]

Short & simple

[edit]

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. Acodebase of multiple files, that performs sophisticateduser orhardware interface or complicatedalgorithms ormultiprogramming is probably not considered a script.

Automates

[edit]

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

Limited language

[edit]

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

[edit]

Typically, a script starts executing at the first line of code whereas an application typically starts at a special point in the code called theentry point.

For example,Java is not script-like since an application starts at the function namedmain which need not be at the top of the code. The following code starts atmain, then callsprintHelloWorld which prints "Hello World".

publicclassHelloWorld{publicstaticvoidprintHelloWorld(){System.out.println("Hello World");}publicstaticvoidmain(String[]args){printHelloWorld();}}

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

print("Hello World")

Single user

[edit]

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

History

[edit]

Earlymainframe computers (in the 1950s) were non-interactive, instead usingbatch processing. IBM'sJob Control Language (JCL) is the archetype of languages used to control batch processing.[7]

The first interactiveshells were developed in the 1960s to enable remote operation of the firsttime-sharing systems, and these usedshell scripts, which controlled running computer programs within a computer program, the shell.Calvin Mooers in hisTRAC language is generally credited with inventingcommand substitution, the ability to embed commands in scripts that, when interpreted, insert a character string into the script.[8]Multics calls theseactive functions.[9]Louis Pouzin wrote an early processor for command scripts called RUNCOM forCTSS around 1964.Stuart Madnick at MIT wrote a scripting language for IBM'sCP/CMS in 1966. He originally called this processor COMMAND, later namedEXEC.[10] Multics included an offshoot of CTSS RUNCOM, also called RUNCOM.[11]EXEC was eventually replaced byEXEC 2 andRexx.

Languages such asTcl andLua were specifically designed as general-purpose scripting languages that could be embedded in any application. Other languages such asVisual 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. Modernweb browsers typically provide a language for writing extensions to the browser itself, and several standard embedded languages for controlling the browser, includingJavaScript (a dialect ofECMAScript) orXUL.

Types

[edit]

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

Glue languages

[edit]

Scripting is often contrasted withsystem programming, as inOusterhout's dichotomy or "programming in the large and programming in the small". In this view, scripting isglue code, connectingsoftware components, and a language specialized for this purpose is aglue language. Pipelines and shell scripting are archetypal examples of glue languages, andPerl was initially developed to fill this same role.Web development can be considered a use of glue languages, interfacing between adatabase andweb 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;[12]
  • smaller programs than those that are better implemented in a compiled language;[13]
  • "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.;[14]
  • scripts that may change;[15]
  • Rapid application development of a solution eventually implemented in another, usually compiled, language.[citation needed]

Glue language examples:

Macro languages exposed to operating system or application components can serve as glue languages. These includeVisual Basic for Applications,WordBasic,LotusScript,CorelScript, Hummingbird Basic, QuickScript, Rexx,SaxBasic, and WinWrap Basic. Other tools likeAWK can also be considered glue languages, as can any language implemented by aWindows 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 theobject 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—includingWindows NT,DOS, and someUnix 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, theTexas InstrumentsTI-92, by factory default can be programmed with a command script language. Inclusion of the scripting and glue languageLua in theTI-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 Ccross-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.[citation needed]

Editor languages

[edit]

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 inCMS .

Job control languages and shells

[edit]
Main article:Shell script

A major class of scripting languages has grown out of the automation ofjob control, which relates to starting and controlling the behavior of system programs[16] (in this sense, one might think of shells as being descendants of IBM's JCL, orJob Control Language, which was used for exactly this purpose). Many of these languages' interpreters double ascommand-line interpreters such as theUnix shell or the MS-DOSCOMMAND.COM. Others, such asAppleScript offer the use of English-like commands to build scripts.

GUI scripting

[edit]

With the advent ofgraphical 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 calledmacros when control is through simulated key presses or mouse clicks, and 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 theoperating system. There are a few exceptions to this limit. Some GUI scripting languages are based on recognizing graphical objects from their display screenpixels. 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 IBMWorkplace Shell, a generic scripting language, e.g.,Object REXX, can be used to write GUI scripts.

Application-specific languages

[edit]

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 byAdobe,Microsoft andGoogle) among others include an idiomatic scripting language tailored to the needs of the application user. Likewise, manycomputer game systems use a custom scripting language to express the programmed actions ofnon-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 ofLisp, 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 one application.

Extension/embeddable languages

[edit]

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 still is mostly, a language for scripting insideweb browsers. However, thestandardizing of the language asECMAScript has made it popular as a general-purpose embeddable language. TheMozilla implementationSpiderMonkey is embedded in several environments such as theYahoo Widgets Engine,and applications such as theAdobe productsFlash (ActionScript) andAcrobat (for scriptingPDF files).

Tcl was created as an extension language but has come to be used more often as a general-purpose language in roles similar toPython,Perl, andRuby. In contrast,Rexx was created as a job control language, but is widely used as an extension language and a general-purpose language. Perl is a general-purpose language, but had the Oraperl (1990) dialect, consisting of aPerl 4 binary withOracle Call Interface compiled in. This has however since been replaced by a library (Perl Module),DBD::Oracle.[17][18]

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 theMaya Embedded Language, orBlender which usesPython 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 famousLua andPython to lesser-known ones such asAngelScript andSquirrel.

See also

[edit]

References

[edit]
  1. ^"ECMAScript 2019 Language Specification". Ecma International. Retrieved2018-04-02.
  2. ^"JBang".jbang.dev. Retrieved11 September 2025.
  3. ^Sheppard, Doug (2000-10-16)."Beginner's Introduction to Perl". Perl.com. Retrieved2011-01-08.
  4. ^Wall, Larry (2007-12-12)."Programming is Hard, Let's Go Scripting".Perl.com.Archived from the original on December 8, 2023.
  5. ^Brown, Vicki; Morin, Rich (1999)."Scripting Languages".MacTech. Retrieved2009-07-22.
  6. ^Loui, Ronald."In Praise of Scripting: Real Programming Pragmatism". IEEE Computer. Archived fromthe original on 2015-09-23. Retrieved2013-08-27.
  7. ^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.
  8. ^Mooers, Calvin (1965)."TRAC, A Procedure-Describing Language for the Reactive Typewriter".TRAC Foundation. Archived fromthe original on 2001-04-25. RetrievedMarch 9, 2012.
  9. ^Van Vleck, Thomas (ed.)."Multics Glossary – A — (active function)".Multics. RetrievedMarch 9, 2012.
  10. ^Varian, Melinda (April 1991)."VM and the VM Community: Past, Present, and Future"(PDF). Archived fromthe original(PDF) on October 6, 2011. RetrievedMarch 9, 2012.
  11. ^Van Vleck, Thomas (ed.)."Multics Glossary – R — (RUNCOM)". RetrievedMarch 9, 2012.
  12. ^"What is glue code (glue code language)? - Definition from WhatIs.com".WhatIs.com. Retrieved2022-01-31.
  13. ^Larson, Quincy (10 January 2020)."Interpreted vs Compiled Programming Languages".Free Code Camp. Retrieved23 February 2022.
  14. ^Balkis, Anton."Script Adalah".Raja Tips. Retrieved23 February 2022.
  15. ^Axelsson, Mats."Shell scripts - What can you change".Linux Hint. Retrieved23 February 2022.
  16. ^"Job Control Basics (Bash Reference Manual)".GNU. Retrieved2022-05-20.
  17. ^"Oraperl - [Deprecated Perl access to Oracle databases for old oraperl scripts]", metacpan.
  18. ^"Perl",Underground Oracle FAQ.
  19. ^van Rossum, Guido (January 6–8, 1998)."Glue It All Together With Python". Python.org.Archived from the original on January 19, 2024.

Further reading

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

External links

[edit]
Wikimedia Commons has media related toScripting languages.
Imperative
Structured
Object-oriented
(comparison,list)
Declarative
Functional
(comparison)
Dataflow
Logic
Domain-
specific
language

(DSL)
Concurrent,
distributed,
parallel
Metaprogramming
Separation
of concerns
Level
Generation
National
Other
Retrieved from "https://en.wikipedia.org/w/index.php?title=Scripting_language&oldid=1317000881"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp