HOME

TheInfoList



OR:

In the programming language
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 lispi ...
, the reader or read function is the
parser Parsing, syntax analysis, or syntactic analysis is the process of analyzing a string of symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal grammar. The term ''parsing'' comes from Lati ...
which converts the textual form of Lisp objects to the corresponding internal object structure. In the original Lisp, S-expressions consisted only of
symbol A symbol is a mark, sign, or word that indicates, signifies, or is understood as representing an idea, object, or relationship. Symbols allow people to go beyond what is known or seen by creating linkages between otherwise very different conc ...
s, integers, and the list constructors ( ''xi...'' ) and (''x'' . ''y''). Later Lisps, culminating in
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fr ...
, added literals for floating-point, complex, and rational numbers, strings, and constructors for vectors. The reader is responsible for parsing list structure, interning symbols, converting numbers to internal form, and calling read macros.


Read table

The reader is controlled by the readtable, which defines the meaning of each
character Character or Characters may refer to: Arts, entertainment, and media Literature * ''Character'' (novel), a 1936 Dutch novel by Ferdinand Bordewijk * ''Characters'' (Theophrastus), a classical Greek set of character sketches attributed to The ...
.


Read macros

Unlike most programming languages, Lisp supports parse-time execution of programs, called "read macros" or "reader macros". These are used to extend the syntax either in universal or program-specific ways. For example, the quoted form (quote ''x'') operator can be abbreviated as ''x''. The ' operator can be defined as a read macro which reads the following list and wraps it with quote. Similarly, the backquote operator (` ) can be defined as a read macro.


References

{{Reflist


Bibliography

* John McCarthy ''et al.'', ''LISP 1.5 Programmer's Manual'', MIT Press, 1962. *
David A. Moon David A. Moon is a programmer and computer scientist, known for his work on the Lisp programming language, as co-author of the Emacs text editor, as the inventor of ephemeral garbage collection, and as one of the designers of the Dylan progra ...
, ''MACLISP Reference Manual'', 1974. *
Guy Steele Guy Lewis Steele Jr. (; born October 2, 1954) is an American computer scientist who has played an important role in designing and documenting several computer programming languages and technical standards. Biography Steele was born in Missouri ...
, ''Common LISP: The Language'', Second Edition, 1990. Lisp (programming language) Parsing