Guile Scheme
   HOME

TheInfoList



OR:

GNU Ubiquitous Intelligent Language for Extensions (GNU Guile) is the preferred
extension language A scripting language or script language is a programming language that is used to manipulate, customize, and automate the facilities of an existing system. Scripting languages are usually interpreted at runtime rather than compiled. A scripting ...
system for the
GNU Project The GNU Project () is a free software, mass collaboration project announced by Richard Stallman on September 27, 1983. Its goal is to give computer users freedom and control in their use of their computers and computing devices by collabor ...
and features an implementation of the programming language
Scheme A scheme is a systematic plan for the implementation of a certain idea. Scheme or schemer may refer to: Arts and entertainment * ''The Scheme'' (TV series), a BBC Scotland documentary series * The Scheme (band), an English pop band * ''The Schem ...
. Its first version was released in 1993. In addition to large parts of Scheme standards, Guile Scheme includes modularized extensions for many different programming tasks. For extending programs, Guile offers ''libguile'' which allows the language to be embedded in other programs, and integrated closely through the C language
application programming interface An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
(API); similarly, new
data type In computer science and computer programming, a data type (or simply type) is a set of possible values and a set of allowed operations on it. A data type tells the compiler or interpreter how the programmer intends to use the data. Most progra ...
s and
subroutine In computer programming, a function or subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed. Functions may ...
s defined through the C API can be made available as extensions to Guile. Guile is used in programs such as GnuCash,
LilyPond LilyPond is a computer program and file format for music engraving. One of LilyPond's major goals is to produce scores that are engraved with traditional layout rules, reflecting the era when scores were engraved by hand. LilyPond is cross-pla ...
,
GNU Guix GNU Guix () is a functional cross-platform package manager and a tool to instantiate and manage Unix-like operating systems, based on the Nix package manager. Configuration and package recipes are written in Guile Scheme. GNU Guix is the defaul ...
,
GNU Debugger The GNU Debugger (GDB) is a portable debugger that runs on many Unix-like systems and works for many programming languages, including Ada, C, C++, Objective-C, Free Pascal, Fortran, Go, and partially others. History GDB was first written ...
, GNU TeXmacs an
Google's schism


Guile Scheme

Guile Scheme is a general-purpose,
high-level programming language In computer science, a high-level programming language is a programming language with strong abstraction from the details of the computer. In contrast to low-level programming languages, it may use natural language ''elements'', be easier to u ...
whose flexibility allows expressing concepts in fewer lines of code than would be possible in languages such as C. For example, its hygienic macro system allows adding domain specific syntax-elements without modifying Guile. Guile implements the Scheme standard R5RS, most of R6RS and R7RS, several Scheme Requests for Implementation (SRFI), and many extensions of its own. The core idea of Guile Scheme is that "the developer implements critical algorithms and data structures in C or C++ and exports the functions and types for use by interpreted code. The application becomes a library of primitives orchestrated by the interpreter, combining the efficiency of compiled code with the flexibility of interpretation." Thus Guile Scheme (and other languages implemented by Guile) can be extended with new
data type In computer science and computer programming, a data type (or simply type) is a set of possible values and a set of allowed operations on it. A data type tells the compiler or interpreter how the programmer intends to use the data. Most progra ...
s and
subroutine In computer programming, a function or subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed. Functions may ...
s implemented through the C API. The standard distribution offers modules for Portable Operating System Interface (
POSIX The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines both the system- and user-level application programming in ...
) system calls, scheduling, a
foreign function interface A foreign function interface (FFI) is a mechanism by which a program written in one programming language can call routines or make use of services written in another. Naming The term comes from the specification for Common Lisp, which explicit ...
,
S-expression In computer programming, an S-expression (or symbolic expression, abbreviated as sexpr or sexp) is an expression in a like-named notation for nested list (tree-structured) data. S-expressions were invented for and popularized by the programming la ...
based
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. T ...
processing through
SXML SXML is an alternative syntax for writing XML data (more precisely, XML Infosets) as S-expressions, to facilitate working with XML data in Lisp and Scheme. An associated suite of tools implements XPath, SAX and XSLT for SXML in Scheme and are a ...
, SXPath, and SXSLT,
HTTP The Hypertext Transfer Protocol (HTTP) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide We ...
and other
World Wide Web The World Wide Web (WWW), commonly known as the Web, is an information system enabling documents and other web resources to be accessed over the Internet. Documents and downloadable media are made available to the network through web ...
APIs,
delimited continuation In programming languages, a delimited continuation, composable continuation or partial continuation, is a "slice" of a continuation frame that has been reified into a function. Unlike regular continuations, delimited continuations return a valu ...
s,
array programming In computer science, array programming refers to solutions which allow the application of operations to an entire set of values at once. Such solutions are commonly used in scientific and engineering settings. Modern programming languages that ...
, and other functionality. Guile programs can use facilities from SLIB, the portable Scheme library.


Implementation details

When using continuations with call/cc, a requirement of the Scheme standard, Guile copies the execution
stack Stack may refer to: Places * Stack Island, an island game reserve in Bass Strait, south-eastern Australia, in Tasmania’s Hunter Island Group * Blue Stack Mountains, in Co. Donegal, Ireland People * Stack (surname) (including a list of people ...
into the heap and back. Its manual suggests using delimited continuations instead, because they have a more efficient implementation. Because foreign code may have pointers to Scheme objects, Guile uses the conservative Boehm–Demers–Weiser (BDW)
garbage collector A waste collector, also known as a garbageman, garbage collector, trashman (in the US), binman or (rarely) dustman (in the UK), is a person employed by a public or private enterprise to collect and dispose of municipal solid waste (refuse) and ...
.


History

The Guile manual gives details of the inception and early history of the language. A brief summary follows: After the success of
Emacs Emacs , originally named EMACS (an acronym for "Editor MACroS"), is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as "the extensible, customizable, ...
in the
free software Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty, n ...
community, as a highly extensible and customizable application via its extension (and partly implementation) language
Emacs Lisp Emacs Lisp is a dialect of the Lisp programming language used as a scripting language by Emacs (a text editor family most commonly associated with GNU Emacs and XEmacs). It is used for implementing most of the editing functionality built into Em ...
, the
community A community is a social unit (a group of living things) with commonality such as place, norms, religion, values, customs, or identity. Communities may share a sense of place situated in a given geographical area (e.g. a country, village, t ...
began to consider how this design strategy could apply to the rest of the GNU system. Tom Lord initially began work on an embeddable language runtime named the GNU Extension Language (GEL), which was based on Aubrey Jaffer's Scheme implementation SCM (which in turn was based on George Carrette's SIOD). Lord convinced
Richard Stallman Richard Matthew Stallman (; born March 16, 1953), also known by his initials, rms, is an American free software movement activist and programmer. He campaigns for software to be distributed in such a manner that its users have the freedom to ...
to make GEL the official extension language of the GNU project, based on the argument that Scheme was a cleaner
Lisp A lisp is a speech impairment in which a person misarticulates sibilants (, , , , , , , ). These misarticulations often result in unclear speech. Types * A frontal lisp occurs when the tongue is placed anterior to the target. Interdental lispin ...
dialect than Emacs Lisp, and that GEL could evolve to implement other languages on the same runtime, namely Emacs Lisp. After Lord discovered GEL had a naming conflict with another programming language, he solicited suggestions for a new name. From several contributions in several
Usenet newsgroup A Usenet newsgroup is a repository usually within the Usenet system, for messages posted from users in different locations using the Internet. They are discussion groups and are not devoted to publishing news. Newsgroups are technically distin ...
s, Lord controversially chose Guile from a suggestion by Lee Thomas. During the development of Guile (then GEL) and before its public release, the extension language Tcl was gaining popularity and being pushed as a universal extension language. Stallman saw Tcl as being underpowered as an extension language, and posted a criticism to the comp.lang.tcl newsgroup, which initiated a flamewar known as the "Tcl War". Since the public announcement of the Guile project coincided with the Tcl debate, it has become a common misconception that Guile began as a reaction to this. After the initial release of Guile, development languished for many years, but 2009–2010 saw major improvements, and Guile 2.0 was released in 2011 with a new
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
infrastructure, a
virtual machine In computing, a virtual machine (VM) is the virtualization/ emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized h ...
implementation, a switch to the Boehm–Demers–Weiser garbage collector, many improvements to the Guile Scheme language, and other major changes. One of the goals of Guile is to allow other languages to be used alongside Scheme, such that Guile would effectively be a language-neutral runtime environment. Various attempts at this have been made in past versions: a
dialect The term dialect (from Latin , , from the Ancient Greek word , 'discourse', from , 'through' and , 'I speak') can refer to either of two distinctly different types of linguistic phenomena: One usage refers to a variety of a language that is ...
of Scheme essentially differing only in its C-like syntax, a translation of
Emacs Lisp Emacs Lisp is a dialect of the Lisp programming language used as a scripting language by Emacs (a text editor family most commonly associated with GNU Emacs and XEmacs). It is used for implementing most of the editing functionality built into Em ...
, a Tcl converter motivated by
tkWWW tkWWW is an early, now discontinued web browser and WYSIWYG HTML editor written by Joseph Wang at MIT as part of Project Athena and the Globewide Network Academy project. The browser was based on the Tcl language and the Tk (toolkit) extens ...
, and something roughly resembling the language
Logo A logo (abbreviation of logotype; ) is a graphic mark, emblem, or symbol used to aid and promote public identification and recognition. It may be of an abstract or figurative design or include the text of the name it represents as in a wo ...
. With version 2.0, the project successfully transitioned to a ''compiler tower'' approach, allowing the definition of compilers from one language to another, typically from a higher-level one to a lower-level
intermediate representation An intermediate representation (IR) is the data structure or code used internally by a compiler or virtual machine to represent source code. An IR is designed to be conducive to further processing, such as optimization and translation. A "good" ...
, and eventually
virtual machine In computing, a virtual machine (VM) is the virtualization/ emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized h ...
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (norma ...
or native
machine code In computer programming, machine code is any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a ve ...
. On 16 Mar 2017, Guile 2.2.0 was released with a new optimizing compiler and high-performance register virtual machine. According to the release announcement by Andy Wingo, real-world programs often showed a speedup of 30% or more with Guile 2.2 when compared to the previous 2.0 series. Guile 2.2.0 also lowered memory usage, sped up the "eval" interpreter, provided better support for multi-core programming, and removed any fixed limit on recursive function calls. It also supported the creation of user-space concurrency facilities that multiplex millions of concurrent lightweight "fibers" and provided a complete Emacs-compatible Elisp implementation, implementing all of Elisp's features and quirks in the same way as Emacs. On 16 January 2020, Guile 3.0.0 was released with just-in-time (
JIT Jit (also known as jiti, jit-jive and the Harare beat) is a style of popular Zimbabwean dance music. It features a swift rhythm played on drums and accompanied by a guitar. Jit evolved out many diverse influences, including domestic chimurenga, ...
) native code generation for much greater performance. Compared to 2.2, microbenchmark performance is around twice as good on the whole, while some individual benchmarks are up to 32 times as fast. It also featured support for interleaved definitions and expressions in lexical contexts, native support for structured exceptions, better support for the R6RS and R7RS Scheme standards and many optimizations.


Emacs integration

There have been several past unfinished attempts to replace or supplement Emacs's
Emacs Lisp Emacs Lisp is a dialect of the Lisp programming language used as a scripting language by Emacs (a text editor family most commonly associated with GNU Emacs and XEmacs). It is used for implementing most of the editing functionality built into Em ...
(Elisp) extension language with Guile, parallel to the efforts of supporting other languages in Guile. With version 2.0 of Guile, a new attempt at implementing Elisp on the Guile compiler tower and replacing Emacs's Elisp implementation with that of libguile has begun and made significant progress through
Google Summer of Code The Google Summer of Code, often abbreviated to GSoC, is an international annual program in which Google awards stipends to contributors who successfully complete a free and open-source software coding project during the summer. , the program is ...
projects. A Guile-based Emacs could offer better execution performance for Emacs Lisp, support new Emacs Lisp language features more easily, make Guile libraries written in other programming languages available to Emacs Lisp code, and allow writing Emacs extensions in other programming languages supported by Guile, all while remaining fully backward compatible with existing Emacs Lisp code bases. , the implementation had reached a stage where Guile Emacs is able to reliably run most Emacs Lisp code. Remaining problems or possible problems involve the different internal representation of Emacs Lisp strings from Scheme strings, the difference between how Emacs Lisp and Scheme treat the Boolean false and empty list objects, Emacs Lisp macros not integrating with Scheme, Emacs Lisp not having been designed for concurrency, and the portability of Guile to platforms supported by Emacs. Other concerns raised by the Emacs community include the relative sizes of the Emacs and Guile communities, and whether it would cause splitting in the community if Emacs were extensible in programming languages other than Emacs Lisp.


GNU Make integration

GNU make In software development, Make is a build automation tool that automatically builds executable programs and libraries from source code by reading files called ''Makefiles'' which specify how to derive the target program. Though integrated d ...
can be built with support for GNU Guile as an embedded extension language.


References


Further reading


"An Anatomy of Guile, The Interface to Tcl/Tk"
(1995) *


External links

*

in one, long web page
Source code
on the GNU Savannah software
forge A forge is a type of hearth used for heating metals, or the workplace (smithy) where such a hearth is located. The forge is used by the smith to heat a piece of metal to a temperature at which it becomes easier to shape by forging, or to th ...

What Is Guile?

"A brief history of guile" (from the Guile manual)


{{DEFAULTSORT:Guile Free compilers and interpreters GNU Project software Scheme (programming language) Scheme (programming language) implementations Scheme (programming language) interpreters Scripting languages Software using the GPL linking exception