You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/chap-2/c-b-character-syntax/_c-b-e-character-syntax-types.md
+23-17Lines changed: 23 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
-
The *Lisp reader* constructs an object from the input text by interpreting each character according to its syntax type. The *Lisp reader* cannot accept as input everything that the *Lisp printer* produces, and the *Lisp reader* has features that are not used by the *Lisp printer*. The *Lisp reader* can be used as a lexical analyzer for a more general user-written parser.
1
+
The *Lisp reader* constructs an <GlossaryTerm term={"object"}><i>object</i></GlossaryTerm> from the input text by interpreting each <GlossaryTerm term={"character"}><i>character</i></GlossaryTerm> according to its <GlossaryTerm styled={true} term={"syntax type"}><i>syntax type</i></GlossaryTerm>. The *Lisp reader* cannot accept as input everything that the *Lisp printer* produces, and the *Lisp reader* has features that are not used by the *Lisp printer*. The *Lisp reader* can be used as a lexical analyzer for a more general user-written parser.
2
2
3
-
When the *Lisp reader* is invoked, it reads a single character from the input stream and dispatches according to the syntax typeof that character. Every character that can appear in the input stream is of one of the syntax types shown in Figure 2–6.
3
+
When the *Lisp reader* is invoked, it reads a single character from the *input stream* and dispatches according to the <GlossaryTerm styled={true} term={"syntax type"}><i>syntax type</i></GlossaryTerm> of that <GlossaryTerm term={"character"}><i>character</i></GlossaryTerm> . Every <GlossaryTerm term={"character"}><i>character</i></GlossaryTerm> that can appear in the *input stream* is of one of the <GlossaryTerm styled={true} term={"syntax type"}><i>syntax types</i></GlossaryTerm> shown in Figure 2–6.
4
4
5
-
<br>
5
+
<br />
6
6
7
7
**Figure 2–6. Possible Character Syntax Types**
8
8
9
-
<br>
9
+
<br />
10
10
11
11
| Syntax Type |
12
12
|---|---|
@@ -17,19 +17,15 @@ When the *Lisp reader* is invoked, it reads a single character from the input st
17
17
| whitespace<sub>2</sub> |
18
18
| invalid |
19
19
20
-
<br>
20
+
<br />
21
21
22
-
The syntax typeof a character in a readtable determines how that character is interpreted by the *Lisp reader* while that readtable is the current readtable. At any given time, every character has exactly one syntax type.
22
+
The <GlossaryTerm styled={true} term={"syntax type"}><i>syntax type</i></GlossaryTerm> of a <GlossaryTerm term={"character"}><i>character</i></GlossaryTerm> in a <GlossaryTerm term={"readtable"}><i>readtable</i></GlossaryTerm> determines how that character is interpreted by the *Lisp reader* while that <GlossaryTerm term={"readtable"}><i>readtable</i></GlossaryTerm> is the <GlossaryTerm styled={true} term={"current readtable"}><i>current readtable</i></GlossaryTerm>. At any given time, every character has exactly one <GlossaryTerm styled={true} term={"syntax type"}><i>syntax type</i></GlossaryTerm>.
23
23
24
-
<br>
24
+
<br />
25
25
26
-
Figure 2–7 lists the syntax typeof each character in standard syntax.
26
+
Figure 2–7 lists the <GlossaryTerm styled={true} term={"syntax type"}><i>syntax type</i></GlossaryTerm> of each <GlossaryTerm term={"character"}><i>character</i></GlossaryTerm> in <GlossaryTerm styled={true} term={"standard syntax"}><i>standard syntax</i></GlossaryTerm>.
27
27
28
-
<br>
29
-
30
-
**Figure 2–7. Character Syntax Types in Standard Syntax**
31
-
32
-
<br>
28
+
<br />
33
29
34
30
| Character | Syntax Type |
35
31
|---|---|
@@ -72,10 +68,20 @@ Figure 2–7 lists the syntax type of each character in standard syntax.
**Figure 2–7. Character Syntax Types in Standard Syntax**
78
+
79
+
<br />
80
+
81
+
The characters marked with an asterisk (\*) are initially <GlossaryTerm term={"constituent"}><i>constituents</i></GlossaryTerm>, but they are not used in any standard Common Lisp notations. These characters are explicitly reserved to the <GlossaryTerm term={"programmer"}><i>programmer</i></GlossaryTerm> . `~` is not used in Common Lisp, and reserved to implementors. `$` and `%` are <GlossaryTerm term={"alphabetic"}><i>alphabetic</i></GlossaryTerm><sub>2</sub> <GlossaryTerm term={"character"}><i>characters</i></GlossaryTerm>, but are not used in the names of any standard Common Lisp <GlossaryTerm styled={true} term={"defined name"}><i>defined names</i></GlossaryTerm>.
82
+
76
83
77
-
The characters marked with an asterisk (*) are initially constituents, but they are not used in any standard Common Lisp notations. These characters are explicitly reserved to the programmer. `~` is not used in Common Lisp, and reserved to implementors. `$` and `%` are alphabetic<sub>2</sub> characters, but are not used in the names of any standard Common Lisp defined names.
78
84
79
-
Whitespace characters serve as separators but are otherwise ignored. Constituent and escape characters are accumulated to make a token, which is then interpreted as a number or symbol. Macro characters trigger the invocation of functions (possibly user-supplied) that can perform arbitrary parsing actions. Macro characters are divided into two kinds, terminating and non-terminating, depending on whether or not they terminate a token. The following are descriptions of each kind of syntax type.
85
+
<GlossaryTerm term={"whitespace"}><i>Whitespace</i></GlossaryTerm><sub>2</sub> characters serve as separators but are otherwise ignored. <GlossaryTerm term={"constituent"}><i>Constituent</i></GlossaryTerm> and *escape characters* are accumulated to make a <GlossaryTerm term={"token"}><i>token</i></GlossaryTerm>, which is then interpreted as a <GlossaryTerm term={"number"}><i>number</i></GlossaryTerm> or <GlossaryTerm term={"symbol"}><i>symbol</i></GlossaryTerm>. <GlossaryTerm styled={true} term={"macro character"}><i>Macro characters</i></GlossaryTerm> trigger the invocation of <GlossaryTerm term={"function"}><i>functions</i></GlossaryTerm> (possibly user-supplied) that can perform arbitrary parsing actions. <GlossaryTerm styled={true} term={"macro character"}><i>Macro characters</i></GlossaryTerm> are divided into two kinds, <GlossaryTerm term={"terminating"}><i>terminating</i></GlossaryTerm> and *non* <GlossaryTerm term={"terminating"}><i>terminating</i></GlossaryTerm>, depending on whether or not they terminate a <GlossaryTerm term={"token"}><i>token</i></GlossaryTerm>. The following are descriptions of each kind of <GlossaryTerm styled={true} term={"syntax type"}><i>syntax type</i></GlossaryTerm>.
0 commit comments