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 | README

commit de1bbc004d4498a969f2ea911cdf9cd8bf130c93
parent 7d3e3f715a27f485f228f34692918c34796e47b5
Author: Wolfgang Corcoran-Mathe <wcm@sigwinch.xyz>
Date:   Fri,  9 Feb 2024 13:40:59 -0500

Grammar formatting: Use @indentedblock, one prod. per paragraph.

This will require some line-breaking protection, but it looks a
lot nicer than the preformatted version.

Diffstat:
Mdoc/r7rs-small/formal-syntax.texinfo | 88++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 76 insertions(+), 12 deletions(-)

diff --git a/doc/r7rs-small/formal-syntax.texinfo b/doc/r7rs-small/formal-syntax.texinfo @@ -68,74 +68,105 @@ the corresponding character. @cindex comment @c TODO: Better alignment in output. -@format +@indentedblock + @svar{token} @expansion{} @svar{identifier} | @svar{boolean} | @svar{number} | @svar{character} | @svar{string} | @code{(} | @code{)} | @code{@hashchar{}(} | @code{@hashchar{}u8} | @code{'} | | @code{`} | @code{,} | @code{,@@} | @code{.} + @svar{delimiter} @expansion{} @svar{whitespace} | @svar{vertical line} | @code{(} | @code{)} | @code{"} | @code{;} + @svar{intraline whitespace} @expansion{} @svar{space or tab} + @svar{whitespace} @expansion{} @svar{intraline whitespace} | @svar{line ending} + @svar{vertical line} @expansion{} @code{|} + @svar{line ending} @expansion{} @svar{newline} | @svar{return} @svar{newline} | @svar{return} + @svar{comment} @expansion{} @code{;} @pseudoprod{all subsequent characters up to a line ending} | @svar{nested comment} | @code{@hashchar{};} @svar{intertoken space} @svar{datum} + @svar{nested comment} @expansion{} @code{@hashchar{}|} @svar{comment text} @arbno{@svar{comment cont}} @code{|@hashchar{}} + @svar{comment text} @expansion{} @pseudoprod{character sequence not containing @code{@hashchar{}|} or @code{|@hashchar{}}} + @svar{comment cont} @expansion{} @svar{nested comment} @svar{comment text} + @svar{directive} @expansion{} @code{@hashchar{}!fold-case} | @code{@hashchar{}!no-fold-case} -@end format + +@end indentedblock Note that it is ungrammatical to follow a @svar{directive} with anything but a @svar{delimiter} or the end of file. -@format +@indentedblock + @svar{atmosphere} @expansion{} @svar{whitespace} ∣ @svar{comment} ∣ @svar{directive} + @svar{intertoken space} @expansion{} @arbno{@svar{atmosphere}} -@end format + +@end indentedblock 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 +@indentedblock + @svar{identifier} @expansion{} @svar{initial} @arbno{@svar{subsequent}} | @svar{vertical line} @arbno{@svar{symbol element}} @svar{vertical line} | @svar{peculiar identifier} + @svar{initial} @expansion{} @svar{letter} | @svar{special initial} + @svar{letter} @expansion{} @code{a} | @code{b} | @code{c} | @dots{} | @code{z} | @code{A} | @code{B} | @code{C} | @dots{} | @code{Z} + @svar{special initial} @expansion{} @code{!} | @code{$} | @code{%} | @code{&} | @code{*} | @code{/} | @code{:} | @code{<} | @code{=} | @code{>} | @code{?} | @code{^} | @code{_} | @code{~} + @svar{subsequent} @expansion{} @svar{initial} | @svar{digit} | @svar{special subsequent} + @svar{digit} @expansion{} @code{0} | @code{1} | @code{2} | @code{3} | @code{4} | @code{5} | @code{6} | @code{7} | @code{8} | @code{9} + @svar{hex digit} @expansion{} @svar{digit} | @code{a} | @code{b} | @code{c} | @code{d} | @code{e} | @code{f} + @svar{explicit sign} @expansion{} @code{+} | @code{-} + @svar{special subsequent} @expansion{} @svar{explicit sign} | @code{.} | @code{@@} + @svar{inline hex escape} @expansion{} @code{\x}@svar{hex scalar value}@code{;} + @svar{hex scalar value} @expansion{} @atleastone{@svar{hex digit}} + @svar{mnemonic escape} @expansion{} @code{\a} | @code{\b} | @code{\t} | @code{\n} | @code{\r} + @svar{peculiar identifier} @expansion{} @svar{explicit sign} | @svar{explicit sign} @svar{sign subsequent} @arbno{@svar{subsequent}} | @svar{explicit sign} @code{.} @svar{dot subsequent} @arbno{@svar{subsequent}} | @code{.} @svar{dot subsequent} @arbno{@svar{subsequent}} + @svar{dot subsequent} @expansion{} @svar{sign subsequent} | @code{.} + @svar{sign subsequent} @expansion{} @svar{initial} | @svar{explicit sign} | @code{@@} + @svar{symbol element} @expansion{} @pseudoprod{any character other than @svar{vertical line} or @code{@backslashchar{}}} | @svar{inline hex escape} | @svar{mnemonic escape} | @code{|} @@ -163,7 +194,8 @@ identifiers. @svar{bytevector} @expansion{} \@hashchar{}u8(@arbno{@svar{byte}}) @svar{byte} @expansion{} @pseudoprod{any exact integer between 0 and 255} -@end format + +@end indentedblock 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 @@ -173,9 +205,11 @@ 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 +@indentedblock + @svar{num @var{R}} @expansion{} @svar{prefix @var{R}} @svar{complex @var{R}} + @svar{complex @var{R}} @expansion{} @svar{real @var{R}} | @svar{real @var{R}} @code{@@} @svar{real @var{R}} | @svar{real @var{R}} @code{+} @svar{ureal @var{R}} @code{i} @@ -188,21 +222,28 @@ in the grammar of numbers can appear in either upper or lower case. | @svar{infnan} @code{i} | @code{+ i} | @code{- i} + @svar{real @var{R}} @expansion{} @svar{sign} @svar{ureal @var{R}} | @svar{infnan} + @svar{ureal @var{R}} @expansion{} @svar{uinteger @var{R}} | @svar{uinteger @var{R}} @code{/} @svar{uinteger @var{R}} | @svar{decimal @var{R}} + @svar{decimal 10} @expansion{} @svar{uinteger 10} @svar{suffix} | @code{.} @atleastone{@svar{digit 10}} @svar{suffix} | @atleastone{@svar{digit 10}} @code{.} @arbno{@svar{digit 10}} @svar{suffix} + @svar{uinteger @var{R}} @expansion{} @atleastone{@svar{digit @var{R}}} + @svar{prefix @var{R}} @expansion{} @svar{radix @var{R}} @svar{exactness} | @svar{exactness} @svar{radix @var{R}} + @svar{infnan} @expansion{} @code{+inf.0} | @code{-inf.0} | @code{+nan.0} | @code{-nan.0} -@end format + +@end indentedblock @sharpindex{b} @sharpindex{o} @@ -210,23 +251,36 @@ in the grammar of numbers can appear in either upper or lower case. @sharpindex{e} @sharpindex{i} -@format +@indentedblock + @svar{suffix} @expansion{} @svar{empty} | @svar{exponent marker} @svar{sign} @atleastone{@svar{digit 10}} + @svar{exponent marker} @expansion{} @code{e} + @svar{sign} @expansion{} @svar{empty} | @code{+} | @code{-} + @svar{exactness} @expansion{} @svar{empty} | @code{@hashchar{}i} | @code{@hashchar{}e} + @svar{radix 2} @expansion{} @code{@hashchar{}b} + @svar{radix 8} @expansion{} @code{@hashchar{}o} + @svar{radix 10} @expansion{} @svar{empty} | @code{@hashchar{}d} + @svar{radix 16} @expansion{} @code{@hashchar{}x} + @svar{digit 2} @expansion{} @code{0} | @code{1} + @svar{digit 8} @expansion{} @code{0} | @code{1} | @code{2} | @code{3} | @code{4} | @code{5} | @code{6} | @code{7} + @svar{digit 10} @expansion{} @svar{digit} + @svar{digit 16} @expansion{} @svar{digit 10} | @code{a} | @code{b} | @code{c} | @code{d} | @code{e} | @code{f} -@end format + +@end indentedblock @node External representations formal @subsection External representations @@ -235,23 +289,33 @@ in the grammar of numbers can appear in either upper or lower case. parses. Note that any string that parses as an @svar{expression} will also parse as a @svar{datum}. -@format +@indentedblock + @svar{datum} @expansion{} @svar{simple datum} ∣ @svar{compound datum} ∣ @svar{label} @code{=} @svar{datum} ∣ @svar{label} @code{@hashchar{}} + @svar{simple datum} @expansion{} @svar{boolean} ∣ @svar{number} ∣ @svar{character} ∣ @svar{string} ∣ @svar{symbol} ∣ @svar{bytevector} + @svar{symbol} @expansion{} @svar{identifier} + @svar{compound datum} @expansion{} @svar{list} ∣ @svar{vector} ∣ @svar{abbreviation} + @svar{list} @expansion{} @code{(}@arbno{@svar{datum}}@code{)} ∣ @code{(}@atleastone{@svar{datum}} @code{.} @svar{datum}@code{)} + @svar{abbreviation} @expansion{} @svar{abbrev prefix} @svar{datum} + @svar{abbrev prefix} @expansion{} @code{'} ∣ @code{`} ∣ @code{,} ∣ @code{,@@} + @svar{vector} @expansion{} @code{@hashchar{}(}@arbno{@svar{datum}}@code{)} + @svar{label} @expansion{} @code{@hashchar{}} @svar{uinteger 10} -@end format + +@end indentedblock @node Expressions formal @subsection Expressions