r7rs-small-texinfo

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit ce8c194bd459681aae86c33708b39ac353f0b62f
parent 2c3ff0be18f91abc8bcbab6274eb9ee97fc9cc84
Author: Yuval Langer <yuvallangerontheroad@gmail.com>
Date:   Sat, 27 Jan 2024 19:00:19 +0200

Deal with errors and now it compiles.

Diffstat:
Mdoc/r7rs-small/r7rs-small.texinfo | 98++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
1 file changed, 55 insertions(+), 43 deletions(-)

diff --git a/doc/r7rs-small/r7rs-small.texinfo b/doc/r7rs-small/r7rs-small.texinfo @@ -38,7 +38,12 @@ Dedicated to the memory of John McCarthy and Daniel Weinreb December 19, 2022 -Summary +@end titlepage + +@node top, Introduction, (dir), (dir) +@top Revised(7) Report on the Algorithmic Language Scheme + +@majorheading Summary The report gives a defining description of the programming language Scheme. Scheme is a statically scoped and properly tail recursive dialect of the Lisp programming language @@ -74,7 +79,6 @@ The report concludes with a list of references and an alphabetic index. R5RS​ ​and R6RS. There is no intended implication that those editors, individually or collectively, support or do not support this report. - @node Introduction @chapter Introduction @@ -649,63 +653,67 @@ Block comments are indicated with properly nested #|and |# pairs. For a description of the notations used for numbers, see section 6.2. -.​ ​+ - +@table @t + +@item @t{.​ ​+ -} These are used in numbers, and can also occur anywhere in an identifier. A delimited plus or minus sign by itself is also an identifier. A delimited period (not occurring within a number or identifier) is used in the notation for pairs (section 6.4), and to indicate a rest-parameter in a formal parameter list (section 4.1.4). Note that a sequence of two or more periods is an identifier. -( ) +@item @t{( )} Parentheses are used for grouping and to notate lists (section 6.4). -' +@item @t{'} The apostrophe (single quote) character is used to indicate literal data (section 4.1.2). -` +@item @t{`} The grave accent (backquote) character is used to indicate partly constant data (section 4.2.8). -, ,@ +@item @t{, ,@@} The character comma and the sequence comma at-sign are used in conjunction with quasiquotation (section 4.2.8). -" +@item @t{"} The quotation mark character is used to delimit strings (section 6.7). -\ +@item @t{\} Backslash is used in the syntax for character constants (section 6.6) and as an escape character within string constants (section 6.7) and identifiers (section 7.1.1). -[ ] { } | +@item @t{[ ] @{ @} |} Left and right square and curly brackets (braces) are reserved for possible future extensions to the language. -# +@item @t{#} The number sign is used for a variety of purposes depending on the character that immediately follows it: -#t #f +@item @t{#t #f} These are the boolean constants (section 6.3), along with the alternatives #true and #false. -#\ +@item @t{#\} This introduces a character constant (section 6.6). -#( +@item @t{#(} This introduces a vector constant (section 6.8). Vector constants are terminated by ) . -#u8( +@item @t{#u8(} This introduces a bytevector constant (section 6.9). Bytevector constants are terminated by ) . -#e #i #b #o #d #x +@item @t{#e #i #b #o #d #x} These are used in the notation for numbers (section 6.2.5). -#<n>= #<n># +@item @t{#<n>= #<n>#} These are used for labeling and referencing other literal data (section 2.4). +@end table + @node Datum labels @section Datum labels @@ -737,7 +745,7 @@ In particular, it is an error for quasiquote (section 4.2.8) to contain them. @node Basic concepts @chapter Basic concepts -@node Variables, syntactic keywords, and regions +@node Variables - syntactic keywords - and regions @section Variables, syntactic keywords, and regions An identifiercan name either a type of syntax or a location where a value can be stored. An @@ -789,8 +797,8 @@ value for the purpose of a conditional test. As explained in section 6.3, all va true in such a test except for #f. This report uses the word “true” to refer to any Scheme value except #f, and the word “false” to refer to #f. -@node External representations -@section External representations +@node External representations (basic) +@section External representations (basic) An important concept in Scheme (and Lisp) is that of the external representation of an object as a sequence of characters. For example, an external representation of the @@ -1125,8 +1133,8 @@ Each procedure created as the result of evaluating a lambda expression is (conce tagged with a storage location, in order to make eqv? and eq? work on procedures (see section 6.1). -@node Conditionals -@subsection Conditionals +@node Conditionals (if) +@subsection Conditionals (if) syntax: (if <test> <consequent> <alternate>) syntax: (if <test> <consequent>) @@ -1183,8 +1191,8 @@ The constructs in this section are hygienic, as discussed in section 4.3. For re purposes, section 7.3 gives syntax definitions that will convert most of the constructs described in this section into the primitive constructs described in the previous section. -@node Conditionals -@subsection Conditionals +@node Conditionals (cond) +@subsection Conditionals (cond) syntax: (cond <clause1> <clause2> …) auxiliary syntax: else @@ -1887,18 +1895,22 @@ or vector <qq template>. an explicit unquote or to put whitespace after the comma, to avoid colliding with the comma at-sign sequence. +@example `(list ,(+ 1 2) 4) ⟹ (list 3 4) (let ((name 'a)) `(list ,name ',name)) ⟹ (list a (quote a)) -`(a ,(+ 1 2) ,@(map abs '(4 -5 6)) b) +`(a ,(+ 1 2) ,@@(map abs '(4 -5 6)) b) ⟹ (a 3 4 5 6 b) -`(( foo ,(- 10 3)) ,@(cdr '(c)) . ,(car '(cons))) +`(( foo ,(- 10 3)) ,@@(cdr '(c)) . ,(car '(cons))) ⟹ ((foo 7) . cons) -`#(10 5 ,(sqrt 4) ,@(map sqrt '(16 9)) 8) +`#(10 5 ,(sqrt 4) ,@@(map sqrt '(16 9)) 8) ⟹ #(10 5 2 4 3 8) -(let ((foo '(foo bar)) (@baz 'baz)) - `(list ,@foo , @baz)) -⟹ (list foo bar baz) Quasiquote expressions can be nested. Substitutions are made only +(let ((foo '(foo bar)) (@@baz 'baz)) + `(list ,@@foo , @@baz)) +⟹ (list foo bar baz) +@end example + +Quasiquote expressions can be nested. Substitutions are made only for unquoted components appearing at the same nesting level as the outermost quasiquote. The nesting level increases by one inside each successive quasiquotation, and decreases by one inside each unquotation. @@ -1924,7 +1936,7 @@ expressions: (let ((a 3)) (list (list 1 2) a 4 'five 6)) The two notations `<qq template> and (quasiquote <qq template>) are identical in all respects. ,<expression> is identical to (unquote -<expression>), and ,@<expression> is identical to (unquote-splicing <expression>). The +<expression>), and ,@@<expression> is identical to (unquote-splicing <expression>). The write procedure may output either format. (quasiquote (list (unquote (+ 1 2)) 4)) @@ -3282,7 +3294,7 @@ a is the real part and b is the imaginary part; and the polar notation -r@θ, where +r@@θ, where r is the magnitude and θ is the phase (angle) in radians. These are related by the equation a + bi = r cos θ + (r sin θ) i. All of @@ -4425,7 +4437,7 @@ y ⟹ (a . 4) (list? y) ⟹ #f (set-cdr! x x) ⟹ unspecified (list? x) ⟹ #f Within literal expressions and representations of objects read by the -read procedure, the forms '<datum>, `<datum>, ,<datum>, and ,@<datum> denote +read procedure, the forms '<datum>, `<datum>, ,<datum>, and ,@@<datum> denote two-element lists whose first elements are the symbols quote, quasiquote, unquote, and unquote-splicing, respectively. The second element in each case is <datum>. This convention is supported so that arbitrary Scheme programs can be represented as lists. @@ -7339,8 +7351,8 @@ empty string. The following extensions to BNF are used to make the description more concise: <thing>* means zero or more occurrences of <thing>; and <thing>+ means at least one <thing>. -@node External representations -@subsection External representations +@node External representations (formal) +@subsection External representations (forma) This section describes how individual tokens(identifiers, numbers, etc.) are formed from sequences of characters. The following sections describe how expressions and programs @@ -7353,7 +7365,7 @@ end of the input. So are dot, numbers, characters, and booleans. Identifiers tha 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: [ ] { } +extensions to the language: [ ] @{ @} In addition to the identifier characters of the ASCII repertoire specified below, Scheme implementations may permit any additional repertoire of non-ASCII Unicode characters to @@ -7472,8 +7484,8 @@ characters used in the grammar of numbers can appear in either upper or lower ca <digit 10> ⟶<digit> <digit 16> ⟶<digit 10> ∣a ∣b ∣c ∣d ∣e ∣f -@node Expressions -@subsection Expressions +@node Expressions (formal) +@subsection Expressions (formal) <Datum> is what the read procedure (section 6.13.2) successfully parses. Note that any string that parses as an <expression> will also parse as a <datum>. @@ -7603,7 +7615,7 @@ following rules for D = 1, 2, 3, …, where D is the nesting depth. ∣(unquote <qq template D−1>) <qq template or splice D> ⟶<qq template D> ∣<splicing unquotation D> -<splicing unquotation D> ⟶,@<qq template D−1> +<splicing unquotation D> ⟶,@@<qq template D−1> ∣(unquote-splicing <qq template D−1>) In <quasiquotation>s, a <list qq template D> can sometimes be confused with either an <unquotation D> or a <splicing unquotation D>. The interpretation as an <unquotation> or <splicing unquotation D> takes precedence. @@ -7645,8 +7657,8 @@ The interpretation as an <unquotation> or <splicing unquotation D> takes precede <ellipsis> ⟶<an identifier defaulting to ...> <underscore> ⟶<the identifier _> -@node Libraries -@subsection Libraries +@node Libraries (formal) +@subsection Libraries (formal) <program> ⟶ <import declaration>+ <command or definition>+ <command or definition> ⟶<command> @@ -7731,8 +7743,8 @@ XXX: TeX! XXX: TeX! -@node Derived expression types -@section Derived expression types +@node Derived expression types (formal) +@section Derived expression types (formal) This section gives syntax definitions for the derived expression types in terms of the primitive expression types (literal, variable, call, lambda, if, and set!), except for