LN 1 ScriptingProgrammingLanguages
LN 1 ScriptingProgrammingLanguages
PROGRAMMING PARADIGM
Scripting Programming Languages
2
Scripting Languages
“Scripting languages assume that a collection of useful components
already exist in other languages. They are intended not for writing
applications from scratch but rather for combining components.”
- John Ousterhout, the creator of Tcl -
Scripting Languages
• Some authors reserve the term “scripting” for the glue
(coordination) languages, but it also includes web
scripting and extension languages.
• Web scripting:
- Growth of the World Wide Web in the late 1990s, Perl was adopted to
become the language for server-side processing.
- One web-scripting enthusiast Rasmus Lerdorf, created a collection of
scripts (written in Perl) to track access to his home page. These scripts
eventually morphed into a fully fledged independent language known as
PHP (currently most popular server side scripting).
Scripting Languages
• Extension languages
- To extent the functionality of complex applications
- Several languages, including Tcl, Rexx, Python, and the Guile and Elk
dialects of Scheme, have implementations designed in such a way that
they can be incorporated into a larger program and used to extend its
features.
Common Characteristics
• Both Batch and Interactive use.
• Economy of Expression.
• Lack of declarations; simple scoping rules
• Flexible dynamic typing.
• Easy access to other programs.
• Sophisticated Pattern matching.
• High-level data types.
Common Characteristics
• Both Batch and Interactive use.
Code can be compile or interpret input line by line.
• Economy of Expression.
• Lack of declarations; simple scoping rules
• Flexible dynamic typing.
• Easy access to other programs.
• Sophisticated Pattern matching.
• High-level data types.
Common Characteristics
• Both Batch and Interactive use.
• Economy of Expression.
• Avoid extensive declaration and top-level structure common
to conventional languages
• Lack of declarations; simple scoping
Conventional language: Java
rules
Scripting language: Python
• Flexible
class Hello { dynamic typing.
print(‘Hello, world!\n’)
public static void main(String[] args) {
• EasySystem.out.println("Hello,
access to otherworld!"); programs.
}
• Sophisticated
} Pattern matching.
• High-level data types.
Common Characteristics
• Both Batch and Interactive use.
• Economy of Expression.
• Lack of declarations; simple scoping rules
• Most scripting language dispense with declaration and provide
simple rules to govern the scope of names. Example:
Perl everything is global by default, optional declaration can be used to
limit variable to a nested scope
Python Any variable that is assigned a value is local to the block in which
the assignment appears. Special syntax is required to assign to a
variable in a surrounding scope.
• Flexible dynamic typing.
• Easy access to other programs.
• Sophisticated Pattern matching.
• High-level data types.
Common Characteristics
• Both Batch and Interactive use.
• Economy of Expression.
• Lack of declarations; simple scoping rules
• Flexible dynamic typing.
• Most scripting languages are dynamically typed.
• For some (e.g. Python and PHP), the type of variable is
checked immediately prior to use.
• Easy access to other programs.
• Sophisticated Pattern matching.
• High-level data types.
Common Characteristics
• Both Batch and Interactive use.
• Economy of Expression.
• Lack of declarations; simple scoping rules
• Flexible dynamic typing.
• Easy access to other programs.
• Scripting languages provide a more fundamental, and have much
more direct support to request the underlying operating system to run
another program, or to perform some operation directly. .
• Sophisticated Pattern matching.
• High-level data types.
Common Characteristics
• Both Batch and Interactive use.
• Economy of Expression.
• Lack of declarations; simple scoping rules
• Flexible dynamic typing.
• Easy access to other programs.
• Sophisticated Pattern matching.
• Scripting languages tend to have extraordinarily rich facilities
for pattern matching, search, and string manipulation.
• High-level data types.
Common Characteristics
• Both Batch and Interactive use.
• Economy of Expression.
• Lack of declarations; simple scoping rules
• Flexible dynamic typing.
• Easy access to other programs.
• Sophisticated Pattern matching.
• High-level data types.
• High-level data types are like sets, bags, dictionaries, lists, and
tuples
• Scripting languages build high-level types into the syntax and
semantics of the language itself.
Common Characteristics
• Both Batch and Interactive use.
• Economy of Expression.
• Lack of declarations; simple scoping rules
• Flexible dynamic typing.
• Easy access to other programs.
• Sophisticated Pattern matching.
• High-level data types.