# Lisp reader

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Lisp_reader
> Markdown URL: https://mediated.wiki/source/Lisp_reader.md
> Source: https://en.wikipedia.org/wiki/Lisp_reader
> Source revision: 758560757
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

In the programming language [Lisp](/source/Lisp_(programming_language)), the '''reader''' or '''<code>read</code> function''' is the [parser](/source/parser) which converts the textual form of  Lisp objects to the corresponding internal object structure.

In the original Lisp, S-expressions consisted only of  [symbol](/source/symbol_(programming))s, integers, and the list constructors <code>( ''x<sub>i</sub>...'' )</code> and <code>(''x'' . ''y'')</code>. Later Lisps, culminating in [Common Lisp](/source/Common_Lisp), added literals for floating-point, complex, and rational  numbers, strings, and constructors for vectors.

The reader is responsible for parsing list structure, [interning](/source/String_interning) symbols, converting numbers to internal form, and calling read macros.

==Read table==

The reader is controlled by the <code>readtable</code>, which defines the meaning of each [character](/source/character_(computing)).

==Read macros{{anchor|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](/source/Lisp_(programming_language))  <code>(quote ''x'')</code> operator can be abbreviated as <code>{{'}}''x''</code>.  The <code>'</code> operator can be defined as a read macro which reads the following list and wraps it with <code>quote</code>. Similarly, the [backquote operator](/source/Lisp_(programming_language)) (` ) can be defined as a read macro.

==References==
{{Reflist}}

==Bibliography==
* [John McCarthy](/source/John_McCarthy_(computer_scientist)) ''et al.'', ''LISP 1.5 Programmer's Manual'', MIT Press, 1962.
* [David A. Moon](/source/David_A._Moon), ''MACLISP Reference Manual'', 1974.
* [Guy Steele](/source/Guy_Steele), ''Common LISP: The Language'', Second Edition, 1990.

Category:Lisp (programming language)
Category:Parsing

---
Adapted from the Wikipedia article [Lisp reader](https://en.wikipedia.org/wiki/Lisp_reader) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Lisp_reader?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
