Go to the first, previous, next, last section, table of contents.


@dircategory Scheme Programming @direntry * guile-ref: (guile-ref). The Guile Reference Manual.

Copyright (C) 1996 Free Software Foundation

Copyright (C) 1997 Free Software Foundation

Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Free Software Foundation.

OK, enough is enough. I can see that I'm not going to be able to fool you guys. I confess everything. You're right. It all was an evil conspiracy. There really isn't a shred of merit in Tcl, or C++, or Perl, or C; there is not a single reason on earth why anyone should use any of these languages for any programming task. Scheme truly is the perfect language that solves every problem and combines the virtues of every other language. For years we've been plotting to trick programmers into using bad languages. Yes, I mean "we". Many many people have participated in this sinister plot, including Larry Wall, Dennis Ritchie, Bill Gates, the Bureau of ATF, most of the LAPD, and Mark Fuhrman (sorry you guys, but the truth has overwhelmed me so I've been forced to expose you). I feel just terrible at how I have set the programming world back, and I promise to be a good boy from now on.

--- John Ousterhout

@unnumbered{Part I: Preliminaries}

Introduction

Guile is an interpreter for the Scheme programming language, packaged for use in a wide variety of environments. Guile implements Scheme as described in the Report on the Algorithmic Language Scheme (usually known as R4RS), providing clean and general data and control structures. Guile goes beyond the rather austere language presented in R4RS, extending it with a module system, full access to POSIX system calls, networking support, multiple threads, dynamic linking, a foreign function call interface, powerful string processing, and many other features needed for programming in the real world.

Like a shell, Guile can run interactively, reading expressions from the user, evaluating them, and displaying the results, or as a script interpreter, reading and executing Scheme code from a file. However, Guile is also packaged as an object library, allowing other applications to easily incorporate a complete Scheme interpreter. An application can use Guile as an extension language, a clean and powerful configuration language, or as multi-purpose "glue", connecting primitives provided by the application. It is easy to call Scheme code from C code and vice versa, giving the application designer full control of how and when to invoke the interpreter. Applications can add new functions, data types, control structures, and even syntax to Guile, creating a domain-specific language tailored to the task at hand, but based on a robust language design.

Guile's module system allows one to break up a large program into manageable sections with well-defined interfaces between them. Modules may contain a mixture of interpreted and compiled code; Guile can use either static or dynamic linking to incorporate compiled code. Modules also encourage developers to package up useful collections of routines for general distribution; as of this writing, one can find Emacs interfaces, database access routines, compilers, GUI toolkit interfaces, and HTTP client functions, among others.

In the future, we hope to expand Guile to support other languages like Tcl and Perl by compiling them to Scheme code. This means that users can program applications which use Guile in the language of their choice, rather than having the tastes of the application's author imposed on them.

This manual assumes you know Scheme, as described in R4RS. From there, it describes:

Part I
how to use Guile interactively and as an interpreter, how to link Guile into your own applications, and how to write modules of interpreted and compiled code for use with Guile,
Part II
Guile's extensions to the language described in R4RS,
Part III
how to call Guile from C code, and how to add new functions written in C to Guile, using C functions which (we hope) will also someday work with other Scheme interpreters, allowing you to write C code which will work with any of several Scheme systems, and
Part IV
further functions available to the C level which are specific to Guile, but provide more thorough access to Guile's internals.

Finally, the appendices explain how to obtain the latest version of Guile, how to install it, where to find modules to work with Guile, and how to use the Guile debugger.


Go to the first, previous, next, last section, table of contents.