|Scripting Language | Image credit: CourseTalk|
Scripting languages had been in existence before many conventional or traditional programming languages. The idea emanated in the 50s when mainframes were the computer system in use then. They were not so interactive as today's computers are, so scripting languages were developed to process jobs then. Many jobs were processed in batches due to the non-interactive mode of mainframes, so scripting languages were written to execute task in batches called Batch processing. It was during that era that IBM's JCL (Job Control Language) was developed and was 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 was one of the earliest project. 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 (Restructured EXtended eXecutor).
Scripting Languages are interpreted, one of the main benefits of interpreted languages is that they require no compilation. The language is interpreted at run-time so the instructions are executed immediately. Errors in an interpreted program will result in the execution of the code to be halted.
Interpreted languages also have a simple syntax which, for the user:
- makes them easy to learn and use
- assumes minimum programming knowledge or experience
- allows complex tasks to be performed in relatively few steps
- allows simple creation and editing in a variety of text editors
- allows the addition of dynamic and interactive activities to web pages
Also, interpreted languages are generally portable across various hardware and network platforms and scripts can be embedded in standard text documents for added functionality.
Unlike a compiler, an interpreter checks syntax and generates object code one source line at a time. As the interpreter executes each line of code at a time the programmer is able to see the results of their programs immediately which can also help with debugging (correcting errors). Compiler, Interpreter and Assembler are all Language Translator - they translate from high-level languages (compiler or interpreter) or assembly language (assembler) to the machine readable format (Machine Language) before program execution.
Types of Scripting Language
Glue Language: A glue language is a programming language (usually an interpreted scripting language) that is designed or suited for writing glue code - code to connect software components. They 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 executable, 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 prototypes of a solution.
Job control languages and shells: JCL or Job Control Language is a programming language designed to control how jobs are executed by the computer processor. JCL is a language used to construct statements that identify a particular job to be run and specify the job's requirements to the operating system under which it will run.
Shell: a shell is a user interface for access to an operating system's services. In general, operating system shells use either a command-line interface (CLI) or graphical user interface (GUI), depending on a computer's role and particular operation.
Application-specific languages: An application-specific scripting language can be viewed as a domain-specific programming language specialized to a single application. 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.
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.
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.
Importance of Scripting Language
Scripting languages are useful in achieving the following purposes;
1. They are used to interface different applications i.e connecting two or more applications together, major function of glue scripting languages.
2. They are used to develop Shell (Command Line Interface (CLI)) to interact directly with the processor.
3. They are used to design simple and very interactive GUI (Graphic User Interface) interface.
4. Scripting languages are used in developing suitable web applications.
5. General purpose scripting languages such as Python, Perl, Ruby, PHP etc are used to program development environments (DE).
6. They are used in designing embedded systems or applications.