Transcript Chapter 1

Scripting Languages
Info derived largely from
Programming Language
Pragmatics, by Michael Scott
Conventional Languages
• Stress efficiency, maintainability, portability,
static detection of errors
Scripting Languages
• Stress flexibility, rapid development, local
customization and dynamic (run-time) checking
• Embrace high-level concepts like tables,
patterns, lists and files
• Often used as “glue” to connect useful
components from other languages
• More recently, includes scripting capabilities to
add dynamic behavior to the web
Common characteristics
• Often includes interactive (interpreted) use
• Tend to be more concise
▫ System.out.println(“hello”);
▫ puts “hello”
• Minimize or eliminate declarations
• Simple scoping rules
▫ Some are global by default (e.g., Perl)
▫ Some are local by default (e.g., PHP)
▫ Scoping rules vary widely
• Most are dynamically typed
Common characteristics*, cont.
• Tend to have more direct access to OS functions
• Often rely on pattern matching and flexible
string manipulation
• Build high-level types (e.g., sets, maps, etc.) into
semantics of language itself (not just in libraries)
* capabilities also in traditional languages, but not as simple to access
What do we use them for?
(domains)
• Command languages (e.g., bash) often
manipulate files, argument and commands.
Includes options like redirection, piping,
execution, simple data types (e.g., string). Text
processing (e.g., sed, awk) common… think of
patterns in file names, etc.
• Mathematics and statistics
▫ Maple, Mathematica, Matlab, R
▫ Provide support for numerical methods, symbolic
math, data visualization, modeling
Domains, continued
• General purpose
▫ Perl, Tcl, Python, Ruby
• Extension languages
▫ Allow users to create new commands
▫ AutoCAD, Maya, Director, Flash have scripting
languages
▫ GIMP can be scripted in Scheme, Tcl, Python, Perl
and others
Domains, continued
• Web
▫ Server side, such as PHP, CGI
▫ Client side, such as JavaScript