r7rs-small-texinfo

Unnamed repository; edit this file 'description' to name the repository.
git clone https://kaka.farm/~git/r7rs-small-texinfo
Log | Files | Refs

commit 2f1568ca38beb41f0eae3ae285e5f7db65a666a2
parent 1bc725972505daef11cd942680bf6c602c926f74
Author: Wolfgang Corcoran-Mathe <wcm@sigwinch.xyz>
Date:   Tue,  6 Feb 2024 14:49:16 -0500

Formal syntax: Reflow paragraphs.

Diffstat:
Mdoc/r7rs-small/formal-syntax.texinfo | 110+++++++++++++++++++++++++++++++++++++++++--------------------------------------
1 file changed, 57 insertions(+), 53 deletions(-)

diff --git a/doc/r7rs-small/formal-syntax.texinfo b/doc/r7rs-small/formal-syntax.texinfo @@ -1,18 +1,18 @@ @node Formal syntax @section Formal syntax -This section provides a formal syntax for Scheme written in an extended -BNF. +This section provides a formal syntax for Scheme written in an +extended BNF. All spaces in the grammar are for legibility. Case is not significant -except in the definitions of @svar{letter}, @svar{character name} and @svar{mnemonic escape}; for example, @code{#x1A} -and @code{#X1a} are equivalent, but @code{foo} and @code{Foo} -and @code{#\space} and @code{#\Space} are distinct. -@svar{empty} stands for the empty string. - -The following extensions to BNF are used to make the description more -concise: @arbno{@svar{thing}} means zero or more occurrences of -@svar{thing}; and @atleastone{@svar{thing}} means at least one +except in the definitions of @svar{letter}, @svar{character name} +and @svar{mnemonic escape}; for example, @code{#x1A} and @code{#X1a} +are equivalent, but @code{foo} and @code{Foo} and @code{#\space} and +@code{#\Space} are distinct. @svar{empty} stands for the empty string. + +The following extensions to BNF are used to make the description +more concise: @arbno{@svar{thing}} means zero or more occurrences +of @svar{thing}; and @atleastone{@svar{thing}} means at least one @svar{thing}. @menu @@ -28,41 +28,39 @@ concise: @arbno{@svar{thing}} means zero or more occurrences of @node Lexical structure @subsection Lexical structure -This section describes how individual tokens (identifiers, -numbers, etc.) are formed from sequences of characters. The following -sections describe how expressions and programs are formed from sequences +This section describes how individual tokens (identifiers, numbers, +etc.) are formed from sequences of characters. The following sections +describe how expressions and programs are formed from sequences of tokens. -@svar{Intertoken space} can occur on either side of any token, but not -within a token. +@svar{Intertoken space} can occur on either side of any token, but +not within a token. -Identifiers that do not begin with a vertical line are -terminated by a @svar{delimiter} or by the end of the input. -So are dot, numbers, characters, and booleans. -Identifiers that begin with a vertical line are terminated by another vertical line. +Identifiers that do not begin with a vertical line are terminated by +a @svar{delimiter} or by the end of the input. So are dot, numbers, +characters, and booleans. Identifiers that begin with a vertical +line are terminated by another vertical line. -The following four characters from the ASCII repertoire -are reserved for future extensions to the -language: @code{[ ] @{ @}} +The following four characters from the ASCII repertoire are reserved +for future extensions to the language: @code{[ ] @{ @}} -In addition to the identifier characters of the ASCII repertoire specified -below, Scheme implementations may permit any additional repertoire of -Unicode characters to be employed in identifiers, +In addition to the identifier characters of the ASCII repertoire +specified below, Scheme implementations may permit any additional +repertoire of Unicode characters to be employed in identifiers, provided that each such character has a Unicode general category of Lu, Ll, Lt, Lm, Lo, Mn, Mc, Me, Nd, Nl, No, Pd, Pc, Po, Sc, Sm, Sk, So, or Co, or is U+200C or U+200D (the zero-width non-joiner and joiner, respectively, which are needed for correct spelling in Persian, Hindi, -and other languages). -However, it is an error for the first character to have a general category -of Nd, Mc, or Me. It is also an error to use a non-Unicode character -in symbols or identifiers. +and other languages). However, it is an error for the first character +to have a general category of Nd, Mc, or Me. It is also an error to +use a non-Unicode character in symbols or identifiers. All Scheme implementations must permit the escape sequence -@code{\x}@svar{hexdigits}@code{;} -to appear in Scheme identifiers that are enclosed in vertical lines. If the character -with the given Unicode scalar value is supported by the implementation, -identifiers containing such a sequence are equivalent to identifiers -containing the corresponding character. +@code{\x}@svar{hexdigits}@code{;} to appear in Scheme identifiers +that are enclosed in vertical lines. If the character with the given +Unicode scalar value is supported by the implementation, identifiers +containing such a sequence are equivalent to identifiers containing +the corresponding character. @c TODO: Better alignment in output. @format @@ -89,8 +87,8 @@ containing the corresponding character. @svar{directive} @expansion{} @code{#!fold-case} | @code{#!no-fold-case} @end format -Note that it is ungrammatical to follow a @svar{directive} with anything -but a @svar{delimiter} or the end of file. +Note that it is ungrammatical to follow a @svar{directive} with +anything but a @svar{delimiter} or the end of file. @format @svar{atmosphere} @expansion{} @svar{whitespace} ∣ @svar{comment} @@ -98,8 +96,8 @@ but a @svar{delimiter} or the end of file. @svar{intertoken space} @expansion{} @arbno{@svar{atmosphere}} @end format -Note that @code{+i}, @code{-i} and @svar{infnan} below are exceptions to the -@svar{peculiar identifier} rule; they are parsed as numbers, not +Note that @code{+i}, @code{-i} and @svar{infnan} below are exceptions +to the @svar{peculiar identifier} rule; they are parsed as numbers, not identifiers. @format @@ -162,11 +160,13 @@ identifiers. @svar{byte} @expansion{} @pseudoprod{any exact integer between 0 and 255} @end format -The following rules for @svar{num R}, @svar{complex R}, @svar{real R}, @svar{ureal R}, @svar{uinteger R}, and -@svar{prefix R} are implicitly replicated for R = 2, 8, 10, and 16. There are no rules for @svar{decimal -2}, @svar{decimal 8}, and @svar{decimal 16}, which means that numbers containing decimal points -or exponents are always in decimal radix. Although not shown below, all alphabetic -characters used in the grammar of numbers can appear in either upper or lower case. +The following rules for @svar{num R}, @svar{complex R}, @svar{real R}, +@svar{ureal R}, @svar{uinteger R}, and @svar{prefix R} are implicitly +replicated for R = 2, 8, 10, and 16. There are no rules for +@svar{decimal 2}, @svar{decimal 8}, and @svar{decimal 16}, which means +that numbers containing decimal points or exponents are always in +decimal radix. Although not shown below, all alphabetic characters used +in the grammar of numbers can appear in either upper or lower case. @format @svar{num @var{R}} @expansion{} @svar{prefix @var{R}} @@ -220,8 +220,9 @@ characters used in the grammar of numbers can appear in either upper or lower ca @node External representations formal @subsection External representations -@svar{Datum} is what the read procedure (@ref{Input}) successfully parses. Note that any -string that parses as an @svar{expression} will also parse as a @svar{datum}. +@svar{Datum} is what the read procedure (@ref{Input}) successfully +parses. Note that any string that parses as an @svar{expression} will +also parse as a @svar{datum}. @format @svar{datum} @expansion{} @svar{simple datum} ∣ @svar{compound datum} @@ -244,18 +245,20 @@ string that parses as an @svar{expression} will also parse as a @svar{datum}. @node Expressions formal @subsection Expressions -The definitions in this and the following subsections assume that all the syntax keywords -defined in this report have been properly imported from their libraries, and that none of -them have been redefined or shadowed. +The definitions in this and the following subsections assume that all +the syntax keywords defined in this report have been properly imported +from their libraries, and that none of them have been redefined or +shadowed. [grammar] @node Quasiquotations @subsection Quasiquotations -The following grammar for quasiquote expressions is not context-free. It is presented as -a recipe for generating an infinite number of production rules. Imagine a copy of the -following rules for @var{D} = 1, 2, 3, @dots{}, where @var{D} is the nesting depth. +The following grammar for quasiquote expressions is not context-free. +It is presented as a recipe for generating an infinite number of +production rules. Imagine a copy of the following rules for @var{D} = +1, 2, 3, @dots{}, where @var{D} is the nesting depth. [grammar] @@ -269,8 +272,9 @@ The interpretation as an @svar{unquotation} or @node Transformers @subsection Transformers -Note: Though this grammar does not say so, a top-level @code{syntax-rules} pattern must be -a list pattern, not a vector pattern or an identifier pattern. +Note: Though this grammar does not say so, a top-level +@code{syntax-rules} pattern must be a list pattern, not a vector +pattern or an identifier pattern. [grammar]