DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(guile-tut.info.gz) What are scripting and extension languages

Info Catalog (guile-tut.info.gz) Introduction (guile-tut.info.gz) History of Guile and its motivations
 
 2.1 What are scripting and extension languages
 ==============================================
 
 A "scripting language" is a programming language which serves as glue
 between other system programs.  In the UNIX world, the traditional
 scripting language is the _Bourne shell_, which allows many UNIX
 commands to be executed in sequence, or in a pipeline.  Traditional UNIX
 commands are cleverly written to work well when put together in a
 script.
 
   Other examples of UNIX scripting languages are AWK, Perl, Scsh (the
 Scheme Shell: a Scheme interpreter enhanced to do good scripting),
 Python, Tcl, Java ...  
 
   UNIX programmers noticed, more than 25 years ago, that scripting
 languages can do serious work, so the Bourne shell was written to have
 variables, operators and control structures, just like a full-featured
 programming language.  
 
   What scripting languages have, that traditional programming languages
 do not, is the ability to easily run an external program (or a pipeline
 of external programs) and use the returned values and output from that
 program in useful ways.
 
   An "extension language" is a programming language interpreter offered
 by an application program, so that users can write macros or even
 full-fledged programs to extend the original application.  Extension
 languages have a C interface (it is usually C, but it could be any
 other compiled language), and can be given access to the C data
 structures.  Likewise, there are C routines to access the extension
 language data structures.
 
   Extension languages abound in the software world, even though the name
 _extension language_ is seldom used.  Examples are: 
 
    * Emacs Lisp, the language used to program and customize GNU Emacs.  
 
    * Tcl, John Ousterhout's general-purpose scripting and extension
      language.  
 
    * The Lotus 1-2-3 macro language (any spreadsheet macro language,
      really).  I mention this one first because it is a classic, even
      though it is seldom used any more.  
 
    * Other spreadsheet and database macro languages.
 
    * The Dominion empire-style game's _exec_ files.  
 
    * Any syntax for a ".*rc" file you might have used.  Almost all
      programs end up parsing some kind of startup or configuration
      file.  The syntax for those can get pretty involved, thus
      justifying calling them "extension languages".  The _fvwm_ window
      manager, for example, parses a rather elaborate `.fvwmrc' file.
 
    * Brent Benson's libscheme.a, an embeddable Scheme interpreter.  
 
    * Guile, the GNU extension language, which is the subject of this
      tutorial.
 
 
   One lesson we can learn from looking at classical large software
 applications is that "writers of large programs" always end up throwing
 in some kind of parser for configuration or scripting.
 
   Of the examples listed above, Emacs Lisp, Tcl, Libscheme and Guile
 have an important property: they are not added as an afterthought for a
 specific application.  They are general-purpose languages which a user
 can learn (even in college courses) and then use to customize the
 application program.
 
   This is a recent and (in my opinion) very exciting direction in
 large-program software engineering: program designers can link in the
 Guile or Tcl library from the very beginning, and tell their users "You
 want to customize this program?  Just use Scheme (or Tcl, or whatever
 language), which you already know!"  
 
Info Catalog (guile-tut.info.gz) Introduction (guile-tut.info.gz) History of Guile and its motivations
automatically generated byinfo2html