concept-syntax.tex 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. %-*- Mode: TeX -*-
  2. %% Character Syntax
  3. %% 2.2.1 1
  4. %% 2.2.1 2
  5. %% 22.1.5 1
  6. The \term{Lisp reader} takes \term{characters} from a \term{stream},
  7. interprets them as a printed representation of an \term{object},
  8. constructs that \term{object}, and returns it.
  9. \DefineSection{TheStandardSyntax}
  10. The syntax described by this chapter is called the \newterm{standard syntax}.
  11. Operations are provided by \clisp\ so that
  12. various aspects of the syntax information represented by a \term{readtable}
  13. can be modified under program control; \seechapter\Reader.
  14. Except as explicitly stated otherwise,
  15. the syntax used throughout this document is \term{standard syntax}.
  16. \beginSubsection{Readtables}
  17. \DefineSection{Readtables}
  18. Syntax information for use by the \term{Lisp reader} is embodied in an
  19. \term{object} called a \newterm{readtable}. Among other things,
  20. the \term{readtable} contains the association between \term{characters}
  21. and \term{syntax types}.
  22. \Thenextfigure\ lists some \term{defined names} that are applicable to
  23. \term{readtables}.
  24. \displaythree{Readtable defined names}{
  25. *readtable*&readtable-case\cr
  26. copy-readtable&readtablep\cr
  27. get-dispatch-macro-character&set-dispatch-macro-character\cr
  28. get-macro-character&set-macro-character\cr
  29. make-dispatch-macro-character&set-syntax-from-char\cr
  30. }
  31. \beginsubsubsection{The Current Readtable}
  32. \DefineSection{CurrentReadtable}
  33. Several \term{readtables} describing different syntaxes can exist,
  34. but at any given time only one, called the \newterm{current readtable},
  35. affects the way in which \term{expressions}\meaning{2} are parsed
  36. into \term{objects} by the \term{Lisp reader}.
  37. The \term{current readtable} in a given \term{dynamic environment}
  38. is \thevalueof{*readtable*} in that \term{environment}.
  39. To make a different \term{readtable} become the \term{current readtable},
  40. \varref{*readtable*} can be \term{assigned} or \term{bound}.
  41. \endsubsubsection%{The Current Readtable}
  42. \beginsubsubsection{The Standard Readtable}
  43. The \newterm{standard readtable} conforms to \term{standard syntax}.
  44. The consequences are undefined if an attempt is made
  45. to modify the \term{standard readtable}.
  46. %% 22.1.5 3
  47. To achieve the effect of altering or extending \term{standard syntax},
  48. a copy of the \term{standard readtable} can be created; \seefun{copy-readtable}.
  49. The \term{readtable case} of the \term{standard readtable} is \kwd{upcase}.
  50. \endsubsubsection%{The Standard Readtable}
  51. \beginsubsubsection{The Initial Readtable}
  52. The \newterm{initial readtable} is
  53. the \term{readtable} that is the \term{current readtable}
  54. at the time when the \term{Lisp image} starts.
  55. At that time, it conforms to \term{standard syntax}.
  56. The \term{initial readtable} is \term{distinct}
  57. from the \term{standard readtable}.
  58. It is permissible for a \term{conforming program}
  59. to modify the \term{initial readtable}.
  60. \endsubsubsection%{The Initial Readtable}
  61. \endSubsection%{Readtables}
  62. \beginsubsection{Variables that affect the Lisp Reader}
  63. \DefineSection{ReaderVars}
  64. The \term{Lisp reader} is influenced not only by the \term{current readtable},
  65. but also by various \term{dynamic variables}. \Thenextfigure\ lists
  66. the \term{variables} that influence the behavior of the \term{Lisp reader}.
  67. \displaythree{Variables that influence the Lisp reader.}{
  68. *package*&*read-default-float-format*&*readtable*\cr
  69. *read-base*&*read-suppress*&\cr
  70. }
  71. \endsubsection%{Variables that affect the Lisp Reader}
  72. \beginSubsection{Standard Characters}
  73. \DefineSection{StandardChars}
  74. %% Redundant.
  75. % \clisp\ \term{characters} are used for writing programs
  76. % that can be read by a \clisp\ implementation, and for data.
  77. \issue{CHARACTER-PROPOSAL:2-2-1}
  78. All \term{implementations} must support a \term{character} \term{repertoire}
  79. called \typeref{standard-char}; \term{characters} that are members of that
  80. \term{repertoire} are called \newtermidx{standard characters}{standard character}.
  81. The \typeref{standard-char} \term{repertoire} consists of
  82. the \term{non-graphic} \term{character} \term{newline},
  83. the \term{graphic} \term{character} \term{space},
  84. and the following additional
  85. ninety-four \term{graphic} \term{characters} or their equivalents:
  86. \tablefigsix{Standard Character Subrepertoire (Part 1 of 3: Latin Characters)}%
  87. {Graphic ID}{Glyph}{Description}%
  88. {Graphic ID}{Glyph}{Description}{
  89. LA01 & \f{a} & small a &
  90. LN01 & \f{n} & small n \cr
  91. LA02 & \f{A} & capital A &
  92. LN02 & \f{N} & capital N \cr
  93. LB01 & \f{b} & small b &
  94. LO01 & \f{o} & small o \cr
  95. LB02 & \f{B} & capital B &
  96. LO02 & \f{O} & capital O \cr
  97. LC01 & \f{c} & small c &
  98. LP01 & \f{p} & small p \cr
  99. LC02 & \f{C} & capital C &
  100. LP02 & \f{P} & capital P \cr
  101. LD01 & \f{d} & small d &
  102. LQ01 & \f{q} & small q \cr
  103. LD02 & \f{D} & capital D &
  104. LQ02 & \f{Q} & capital Q \cr
  105. LE01 & \f{e} & small e &
  106. LR01 & \f{r} & small r \cr
  107. LE02 & \f{E} & capital E &
  108. LR02 & \f{R} & capital R \cr
  109. LF01 & \f{f} & small f &
  110. LS01 & \f{s} & small s \cr
  111. LF02 & \f{F} & capital F &
  112. LS02 & \f{S} & capital S \cr
  113. LG01 & \f{g} & small g &
  114. LT01 & \f{t} & small t \cr
  115. LG02 & \f{G} & capital G &
  116. LT02 & \f{T} & capital T \cr
  117. LH01 & \f{h} & small h &
  118. LU01 & \f{u} & small u \cr
  119. LH02 & \f{H} & capital H &
  120. LU02 & \f{U} & capital U \cr
  121. LI01 & \f{i} & small i &
  122. LV01 & \f{v} & small v \cr
  123. LI02 & \f{I} & capital I &
  124. LV02 & \f{V} & capital V \cr
  125. LJ01 & \f{j} & small j &
  126. LW01 & \f{w} & small w \cr
  127. LJ02 & \f{J} & capital J &
  128. LW02 & \f{W} & capital W \cr
  129. LK01 & \f{k} & small k &
  130. LX01 & \f{x} & small x \cr
  131. LK02 & \f{K} & capital K &
  132. LX02 & \f{X} & capital X \cr
  133. LL01 & \f{l} & small l &
  134. LY01 & \f{y} & small y \cr
  135. LL02 & \f{L} & capital L &
  136. LY02 & \f{Y} & capital Y \cr
  137. LM01 & \f{m} & small m &
  138. LZ01 & \f{z} & small z \cr
  139. LM02 & \f{M} & capital M &
  140. LZ02 & \f{Z} & capital Z \cr
  141. }
  142. \tablefigsix{Standard Character Subrepertoire (Part 2 of 3: Numeric Characters)}%
  143. {Graphic ID}{Glyph}{Description}%
  144. {Graphic ID}{Glyph}{Description}{
  145. ND01 & \f{1} & digit 1 &
  146. ND06 & \f{6} & digit 6 \cr
  147. ND02 & \f{2} & digit 2 &
  148. ND07 & \f{7} & digit 7 \cr
  149. ND03 & \f{3} & digit 3 &
  150. ND08 & \f{8} & digit 8 \cr
  151. ND04 & \f{4} & digit 4 &
  152. ND09 & \f{9} & digit 9 \cr
  153. ND05 & \f{5} & digit 5 &
  154. ND10 & \f{0} & digit 0 \cr
  155. }
  156. \DefineFigure{StdCharsThree}
  157. \tablefigthree{Standard Character Subrepertoire (Part 3 of 3: Special Characters)}%
  158. {Graphic ID}{Glyph}{Description}{
  159. SP02 & \f{!} & exclamation mark \cr
  160. SC03 & \f{\$} & dollar sign \cr
  161. SP04 & \f{"} & quotation mark, or double quote \cr
  162. SP05 & \f{'} & apostrophe, or \brac{single} quote \cr
  163. SP06 & \f{(} & left parenthesis, or open parenthesis \cr
  164. SP07 & \f{)} & right parenthesis, or close parenthesis \cr
  165. SP08 & \f{,} & comma \cr
  166. SP09 & \f{_} & low line, or underscore \cr
  167. SP10 & \f{-} & hyphen, or minus \brac{sign} \cr
  168. SP11 & \f{.} & full stop, period, or dot \cr
  169. SP12 & \f{/} & solidus, or slash \cr
  170. SP13 & \f{:} & colon \cr
  171. SP14 & \f{;} & semicolon \cr
  172. SP15 & \f{?} & question mark \cr
  173. SA01 & \f{+} & plus \brac{sign} \cr
  174. SA03 & \f{<} & less-than \brac{sign} \cr
  175. SA04 & \f{=} & equals \brac{sign} \cr
  176. SA05 & \f{>} & greater-than \brac{sign} \cr
  177. SM01 & \f{\#} & number sign, or sharp\brac{sign} \cr
  178. SM02 & \f{\%} & percent \brac{sign} \cr
  179. SM03 & \f{\&} & ampersand \cr
  180. SM04 & \f{*} & asterisk, or star \cr
  181. SM05 & \f{@} & commercial at, or at-sign \cr
  182. SM06 & \f{[} & left \brac{square} bracket \cr
  183. SM07 & \f{\\} & reverse solidus, or backslash \cr
  184. SM08 & \f{]} & right \brac{square} bracket \cr
  185. SM11 & \f{\{} & left curly bracket, or left brace \cr
  186. SM13 & \f{|} & vertical bar \cr
  187. SM14 & \f{\}} & right curly bracket, or right brace \cr
  188. SD13 & \f{`} & grave accent, or backquote \cr
  189. SD15 & \f{\hat} & circumflex accent \cr
  190. SD19 & \f{~} & tilde \cr
  191. }
  192. The graphic IDs are not used within \clisp,
  193. but are provided for cross reference purposes with {\ISOChars}.
  194. Note that the first letter of the graphic ID
  195. categorizes the character as follows:
  196. L---Latin, N---Numeric, S---Special.
  197. \endSubsection%{Standard Characters}
  198. \endissue{CHARACTER-PROPOSAL:2-2-1}
  199. \beginSubsection{Character Syntax Types}
  200. \DefineSection{CharacterSyntaxTypes}
  201. %% 22.1.1 1
  202. The \term{Lisp reader} constructs an \term{object}
  203. from the input text by interpreting each \term{character}
  204. according to its \term{syntax type}.
  205. The \term{Lisp reader} cannot accept as input
  206. everything that the \term{Lisp printer} produces,
  207. and the \term{Lisp reader} has features that are not used by the \term{Lisp printer}.
  208. The \term{Lisp reader} can be used as a lexical analyzer
  209. for a more general user-written parser.
  210. %% 22.1.1 2
  211. %% 22.1.1 3
  212. When the \term{Lisp reader} is invoked, it reads a single character from
  213. the \term{input} \term{stream} and dispatches according to the
  214. \newterm{syntax type} of that \term{character}.
  215. Every \term{character} that can appear in the \term{input} \term{stream}
  216. is of one of the \term{syntax types} shown in \figref\PossibleSyntaxTypes.
  217. \DefineFigure{PossibleSyntaxTypes}
  218. \showthree{Possible Character Syntax Types}{
  219. \term{constituent}&\term{macro character}&\term{single escape}\cr
  220. \term{invalid}&\term{multiple escape}&\term{whitespace}\meaning{2}\cr
  221. }
  222. The \term{syntax type} of a \term{character} in a \term{readtable}
  223. determines how that character is interpreted by the \term{Lisp reader}
  224. while that \term{readtable} is the \term{current readtable}.
  225. At any given time, every character has exactly one \term{syntax type}.
  226. %% 22.1.1 4
  227. %% 2.3.0 5
  228. \Figref\CharSyntaxTypesInStdSyntax\
  229. lists the \term{syntax type} of each \term{character} in \term{standard syntax}.
  230. \DefineFigure{CharSyntaxTypesInStdSyntax}
  231. %% 22.1.1 36
  232. {\def\w{\term{whitespace}\meaning{2}}
  233. \def\n{\term{non-terminating} \term{macro char}} %cheat on "char" => "character" to make fit
  234. \def\t{\term{terminating} \term{macro char}} %ditto
  235. \def\c{\term{constituent}}
  236. \def\C{\term{constituent}*}
  237. \def\SE{\term{single escape}}
  238. \def\ME{\term{multiple escape}}
  239. \tablefigfour{Character Syntax Types in Standard Syntax}{character}{syntax type}{character}{syntax type}{
  240. Backspace&\c&0--9&\c\cr
  241. Tab&\w&:&\c\cr
  242. Newline&\w&;&\t\cr
  243. Linefeed&\w&{\tt<}&\c\cr
  244. Page&\w&=&\c\cr
  245. Return&\w&{\tt>}&\c\cr
  246. Space&\w&?&\C\cr
  247. !&\C&{\tt @}&\c\cr
  248. {\tt"}&\t&A--Z&\c\cr
  249. \#&\n&\f{[}&\C\cr
  250. \$&\c&\f{\\}&\SE\cr
  251. \%&\c&\f{]}&\C\cr
  252. \&&\c&\hat&\c\cr
  253. '&\t&\f{\_}&\c\cr
  254. (&\t&`&\t\cr
  255. )&\t&a--z&\c\cr
  256. {\tt*}&\c&\f{\{}&\C\cr
  257. +&\c&\f{|}&\ME\cr
  258. ,&\t&\f{\}}&\C\cr
  259. -&\c&\f{~}&\c\cr
  260. .&\c&Rubout&\c\cr
  261. /&\c\cr
  262. }}
  263. %% The next two paragraphs were mutually redundant, so I collapsed them into one. -kmp 17-Jan-92
  264. The characters marked with an asterisk (*) are initially \term{constituents},
  265. % but are reserved to the user for use as \term{macro characters} or for any other
  266. % desired purpose.
  267. %
  268. % Brackets (\f{[} and \f{]}),
  269. % braces (\f{\{}, \f{\}}),
  270. % question mark (\f{?}),
  271. % and exclamation point (\f{!})
  272. % are defined to be constituents,
  273. but they are not used in any standard \clisp\ notations.
  274. %!!! Maybe make a glossary term out of "reserved to the programmer"
  275. % and discuss the issue of who the "programmer" is in the face of
  276. % cascaded/layered/embedded implementations, some of which are conforming
  277. % and some of which are not.
  278. These characters are explicitly reserved to the \term{programmer}.
  279. \f{~} is not used in \clisp, and reserved to implementors.
  280. \f{\$} and \f{\%} are \term{alphabetic}\meaning{2} \term{characters},
  281. but are not used in the names of any standard \clisp\ \term{defined names}.
  282. \term{Whitespace}\meaning{2} characters serve as separators but are otherwise
  283. ignored. \term{Constituent} and \term{escape} \term{characters} are accumulated
  284. to make a \term{token}, which is then interpreted as a \term{number} or \term{symbol}.
  285. \term{Macro characters} trigger the invocation of \term{functions} (possibly
  286. user-supplied) that can perform arbitrary parsing actions.
  287. \term{Macro characters} are divided into two kinds,
  288. \term{terminating} and \term{non-terminating},
  289. depending on whether or not they terminate a \term{token}.
  290. The following are descriptions of each kind of \term{syntax type}.
  291. \beginsubsubsection{Constituent Characters}
  292. \DefineSection{ConstituentChars}
  293. \term{Constituent} \term{characters} are used in \term{tokens}.
  294. %% Sandra didn't like this wording, and wanted "representation of" added. -kmp 19-Nov-91
  295. %A \term{token} is a \term{number} or a \term{symbol} name.
  296. A \newterm{token} is a representation of a \term{number} or a \term{symbol}.
  297. Examples of \term{constituent} \term{characters} are letters and digits.
  298. %% 2.3.0 6
  299. Letters in symbol names are sometimes converted to
  300. letters in the opposite \term{case} when the name is read;
  301. \seesection\ReadtableCaseReadEffect.
  302. \term{Case} conversion can be suppressed by the use
  303. of \term{single escape} or \term{multiple escape} characters.
  304. %% Moved to the section "Case in Symbols" -kmp 25-Jan-92
  305. % The \term{symbols} that correspond to \clisp\ \term{defined names}
  306. % have uppercase names even though their names generally appear
  307. % in lowercase in this document.
  308. \beginsubsubsection{Constituent Traits}
  309. \DefineSection{ConstituentTraits}
  310. Every \term{character} has one or more \term{constituent traits}
  311. that define how the \term{character} is to be interpreted by the \term{Lisp reader}
  312. when the \term{character} is a \term{constituent} \term{character}.
  313. These \term{constituent traits} are
  314. \term{alphabetic}\meaning{2},
  315. digit,
  316. \term{package marker},
  317. plus sign,
  318. minus sign,
  319. dot,
  320. decimal point,
  321. \term{ratio marker},
  322. \term{exponent marker},
  323. and \term{invalid}.
  324. \Figref\ConstituentTraitsOfStdChars\ shows the \term{constituent traits}
  325. of the \term{standard characters}
  326. and of certain \term{semi-standard} \term{characters};
  327. % I added this next to clarify. It effectively says the same thing in SET-SYNTAX-FROM-CHAR.
  328. % -kmp 28-Jan-92
  329. no mechanism is provided for changing the \term{constituent trait} of a \term{character}.
  330. Any \term{character} with the alphadigit \term{constituent trait}
  331. in that figure is a digit if the \term{current input base} is greater
  332. than that character's digit value,
  333. otherwise the \term{character} is \term{alphabetic}\meaning{2}.
  334. %\term{Alphabetic}\meaning{2} \term{constituents} are valid
  335. %\term{characters} for \term{symbol} \term{names}.
  336. Any \term{character} quoted by a \term{single escape}
  337. is treated as an \term{alphabetic}\meaning{2} constituent, regardless of its normal syntax.
  338. \DefineFigure{ConstituentTraitsOfStdChars}
  339. \boxfig
  340. {\dimen0=.75pc
  341. \def\a{\term{alphabetic}\meaning{2}}
  342. \def\ad{alphadigit}
  343. \def\i{\term{invalid}}
  344. \def\pm{\term{package marker}}
  345. \tabskip \dimen0
  346. \halign to \hsize {#\hfil\tabskip \dimen0&#\hfil\tabskip 0pt plus 1fil
  347. &#\hfil\tabskip \dimen0&#\hfil\cr
  348. \noalign{\vskip -9pt}
  349. \bf constituent&\bf traits&\bf constituent&\bf traits\cr
  350. \bf character&&\bf character\cr
  351. \noalign{\vskip 2pt\hrule\vskip 2pt}
  352. Backspace&\i&\f{\{}&\a\cr
  353. Tab&\i*&\f{\}}&\a\cr
  354. Newline&\i*&+&\a, plus sign\cr
  355. Linefeed&\i*&-&\a, minus sign\cr
  356. Page&\i*&.&\a, dot, decimal point\cr
  357. Return&\i*&/&\a, \term{ratio marker}\cr
  358. Space&\i*&A, a&\ad\cr
  359. ! &\a&B, b&\ad\cr
  360. {\tt "}&\a*&C, c&\ad\cr
  361. \#&\a*&D, d&\ad, double-float \term{exponent marker}\cr
  362. \$&\a&E, e&\ad, float \term{exponent marker}\cr
  363. \%&\a&F, f&\ad, single-float \term{exponent marker}\cr
  364. \&&\a&G, g&\ad\cr
  365. '&\a*&H, h&\ad\cr
  366. (&\a*&I, i&\ad\cr
  367. )&\a*&J, j&\ad\cr
  368. {\tt *}&\a&K, k&\ad\cr
  369. ,&\a*&L, l&\ad, long-float \term{exponent marker}\cr
  370. 0-9&\ad&M, m&\ad\cr
  371. :&\pm&N, n&\ad\cr
  372. ;&\a*&O, o&\ad\cr
  373. {\tt<}&\a&P, p&\ad\cr
  374. =&\a&Q, q&\ad\cr
  375. {\tt>}&\a&R, r&\ad\cr
  376. ?&\a&S, s&\ad, short-float \term{exponent marker}\cr
  377. \f{@}&\a&T, t&\ad\cr
  378. \f{[}&\a&U, u&\ad\cr
  379. \f{\\}&\a*&V, v&\ad\cr
  380. \f{]}&\a&W, w&\ad\cr
  381. \hat&\a&X, x&\ad\cr
  382. \f{\_}&\a&Y, y&\ad\cr
  383. `&\a*&Z, z&\ad\cr
  384. \f{|}&\a*&Rubout&\i\cr
  385. \f{~}&\a\cr
  386. \noalign{\vskip -9pt}
  387. }}
  388. \caption{Constituent Traits of Standard Characters and Semi-Standard Characters}
  389. \endfig
  390. The interpretations in this table apply only to \term{characters}
  391. whose \term{syntax type} is \term{constituent}.
  392. Entries marked with an asterisk (*) are normally \term{shadowed}\meaning{2}
  393. because the indicated \term{characters} are of \term{syntax type}
  394. \term{whitespace}\meaning{2},
  395. \term{macro character},
  396. \term{single escape},
  397. or \term{multiple escape};
  398. these \term{constituent traits} apply to them only if their \term{syntax types}
  399. are changed to \term{constituent}.
  400. \endsubsubsection%{Constituent Traits}
  401. \endsubsubsection%{Constituent Characters}
  402. \beginsubsubsection{Invalid Characters}
  403. \DefineSection{InvalidChars}
  404. \term{Characters} with the \term{constituent trait} \term{invalid}
  405. cannot ever appear in a \term{token}
  406. except under the control of a \term{single escape} \term{character}.
  407. If an \term{invalid} \term{character} is encountered while an \term{object} is
  408. being read, an error \oftype{reader-error} is signaled.
  409. If an \term{invalid} \term{character} is preceded by a \term{single escape} \term{character},
  410. it is treated as an \term{alphabetic}\meaning{2} \term{constituent} instead.
  411. \endsubsubsection%{Invalid Characters}
  412. \beginsubsubsection{Macro Characters}
  413. \DefineSection{MacroChars}
  414. When the \term{Lisp reader} encounters a \term{macro character}
  415. on an \term{input} \term{stream},
  416. special parsing of subsequent \term{characters}
  417. on the \term{input} \term{stream}
  418. is performed.
  419. A \term{macro character} has an associated \term{function}
  420. called a \newterm{reader macro function} that implements its specialized parsing behavior.
  421. An association of this kind can be established or modified under control of
  422. a \term{conforming program} by using
  423. \thefunctions{set-macro-character} and \funref{set-dispatch-macro-character}.
  424. Upon encountering a \term{macro character}, the \term{Lisp reader} calls its
  425. \term{reader macro function}, which parses one specially formatted object
  426. from the \term{input} \term{stream}.
  427. The \term{function} either returns the parsed \term{object},
  428. or else it returns no \term{values}
  429. to indicate that the characters scanned by the \term{function}
  430. are being ignored (\eg in the case of a comment).
  431. Examples of \term{macro characters}
  432. are \term{backquote}, \term{single-quote}, \term{left-parenthesis}, and
  433. \term{right-parenthesis}.
  434. A \term{macro character} is either \term{terminating} or \term{non-terminating}.
  435. The difference between \term{terminating} and \term{non-terminating} \term{macro characters}
  436. lies in what happens when such characters occur in the middle of a \term{token}.
  437. If a \newterm{non-terminating} \term{macro character} occurs in the middle of a \term{token},
  438. the \term{function} associated
  439. with the \term{non-terminating} \term{macro character} is not called,
  440. and the
  441. \term{non-terminating} \term{macro character} does not terminate the \term{token}'s name; it
  442. becomes part of the name as if the \term{macro character} were really a constituent
  443. character. A \newterm{terminating} \term{macro character} terminates any \term{token},
  444. and its associated \term{reader macro function}
  445. is called no matter where the \term{character} appears.
  446. The only \term{non-terminating} \term{macro character} in \term{standard syntax}
  447. is \term{sharpsign}.
  448. If a \term{character} is a \term{dispatching macro character} $C\sub 1$,
  449. its \term{reader macro function} is a \term{function} supplied by the \term{implementation}.
  450. This \term{function} reads decimal \term{digit} \term{characters} until a non-\term{digit}
  451. $C\sub 2$ is read.
  452. If any \term{digits} were read,
  453. they are converted into a corresponding \term{integer} infix parameter $P$;
  454. otherwise, the infix parameter $P$ is \nil.
  455. The terminating non-\term{digit} $C\sub 2$ is a \term{character}
  456. (sometimes called a ``sub-character'' to emphasize its subordinate role in the dispatching)
  457. that is looked up in the dispatch table associated with
  458. the \term{dispatching macro character} $C\sub 1$.
  459. The \term{reader macro function} associated with the sub-character $C\sub 2$
  460. is invoked with three arguments:
  461. the \term{stream},
  462. the sub-character $C\sub 2$,
  463. and the infix parameter $P$.
  464. For more information about dispatch characters,
  465. \seefun{set-dispatch-macro-character}.
  466. For information about the \term{macro characters}
  467. that are available in \term{standard syntax},
  468. \seesection\StandardMacroChars.
  469. \endsubsubsection%{Macro Characters}
  470. \beginsubsubsection{Multiple Escape Characters}
  471. \DefineSection{MultipleEscapeChar}
  472. A pair of \newterm{multiple escape} \term{characters}
  473. is used to indicate that an enclosed sequence of characters,
  474. including possible \term{macro characters} and \term{whitespace}\meaning{2} \term{characters},
  475. are to be treated as \term{alphabetic}\meaning{2} \term{characters}
  476. with \term{case} preserved.
  477. Any \term{single escape} and \term{multiple escape} \term{characters}
  478. that are to appear in the sequence must be preceded by a \term{single escape}
  479. \term{character}.
  480. \term{Vertical-bar} is a \term{multiple escape} \term{character}
  481. in \term{standard syntax}.
  482. \beginsubsubsubsection{Examples of Multiple Escape Characters}
  483. \code
  484. ;; The following examples assume the readtable case of *readtable*
  485. ;; and *print-case* are both :upcase.
  486. (eq 'abc 'ABC) \EV \term{true}
  487. (eq 'abc '|ABC|) \EV \term{true}
  488. (eq 'abc 'a|B|c) \EV \term{true}
  489. (eq 'abc '|abc|) \EV \term{false}
  490. \endcode
  491. \endsubsubsubsection%{Examples of Multiple Escape Characters}
  492. \endsubsubsection%{Multiple Escape Characters}
  493. \beginsubsubsection{Single Escape Character}
  494. \DefineSection{SingleEscapeChar}
  495. A \newterm{single escape} is used to indicate that
  496. the next \term{character} is to be treated as
  497. an \term{alphabetic}\meaning{2} \term{character}
  498. with its \term{case} preserved,
  499. no matter what the \term{character} is
  500. or which \term{constituent traits} it has.
  501. %% "slash" => "backslash" as an editorial change per Boyer/Kaufmann/Moore #4.
  502. %% This was right everywhere else in the manual--shame for it to be wrong here.
  503. %% -kmp 9-May-94
  504. \term{Backslash} is a \term{single escape} \term{character} in \term{standard syntax}.
  505. \beginsubsubsubsection{Examples of Single Escape Characters}
  506. \code
  507. ;; The following examples assume the readtable case of *readtable*
  508. ;; and *print-case* are both :upcase.
  509. (eq 'abc '\\A\\B\\C) \EV \term{true}
  510. (eq 'abc 'a\\Bc) \EV \term{true}
  511. (eq 'abc '\\ABC) \EV \term{true}
  512. (eq 'abc '\\abc) \EV \term{false}
  513. \endcode
  514. \endsubsubsubsection%{Examples of Single Escape Characters}
  515. \endsubsubsection%{Single Escape Character}
  516. \beginsubsubsection{Whitespace Characters}
  517. \DefineSection{WhitespaceChars}
  518. \term{Whitespace}\meaning{2} \term{characters} are used to separate \term{tokens}.
  519. \term{Space} and \term{newline} are \term{whitespace}\meaning{2} \term{characters}
  520. in \term{standard syntax}.
  521. \beginsubsubsubsection{Examples of Whitespace Characters}
  522. \code
  523. (length '(this-that)) \EV 1
  524. (length '(this - that)) \EV 3
  525. (length '(a
  526. b)) \EV 2
  527. (+ 34) \EV 34
  528. (+ 3 4) \EV 7
  529. \endcode
  530. \endsubsubsubsection%{Examples of Whitespace Characters}
  531. \endsubsubsection%{Whitespace Characters}
  532. \endSubsection%{Character Syntax Types}