Next: Hash-prefixed forms, Previous: Lexical syntax, Up: Syntax [Contents][Index]
The datum syntax describes the syntax of syntactic data in terms of a sequence of lexemes, as defined in the lexical syntax.
The following grammar describes the syntax of syntactic data in terms of various kinds of lexemes defined in the grammar in section “Lexical Syntax”:
datum ::= defining-datum | nondefining-datum | defined-datum nondefining-datum ::= lexeme-datum | compound-datum lexeme-datum ::= boolean | number | character | string | symbol symbol ::= identifier compound-datum ::= list | vector | uniform-vector | array-literal | extended-string-literal | xml-literal list ::=(datum*)|(datum+.datum)| abbreviation vector ::=#(datum*)
datum-label ::=#indexnum=defining-datum ::= datum-label+nondefining-datum defined-datum ::=#indexnum#indexnum ::= digit+
The lexical syntax #n=datum reads the
same as datum, but also results in datum being
labelled by n, which must a sequence of digits.
The lexical syntax #n# serves as a reference to some
object labelled by #n=; the result is the same object
(in the sense of eq?) as the #n=.
Together, these syntaxes permit the notation of structures with shared or circular substructure.
(let ((x (list 'a 'b 'c))) (set-cdr! (cddr x) x) x) ⇒ #0=(a b c . #0#)
The scope of a datum label is the portion of the outermost
datum in which it appears that is to the right of the label.
Consequently, a reference #n# can occur
only after a label #n=;
it is an error to attempt a forward reference.
In addition, it is an error if the reference appears as the labelled
object itself (as in #n=#n#), because the object
labelled by #n= is not well defined in this case.
abbreviation ::= r6rs-abbreviation | kawa-abbreviation r6rs-abbreviation ::= abbrev-prefix datum abbrev-prefix ::=’|‘|,|,@|#’|#‘kawa-abbreviation ::= XXX
The following abbreviations are expanded at read-time:
’datummeans (quote datum).
‘datummeans (quasiquote datum).
,datummeans (unquote datum).
,@datummeans (unquote-splicing datum).
#’datummeans (syntax datum).
#‘datummeans (quasisyntax datum).
#,datummeans (unsyntax datum).
This abbreviation is currently only recognized when nested inside an explicit
#‘datum form,
because of a conflict with SRFI-10 named constructors.
#,@datummeans (unsyntax-splicing datum).
:datum2means ($lookup$ datum1 (quasiquote datum2)).
See Property access using colon notation.
[expression ...]means ($bracket-list$ expression ...).
[expression ...]means ($bracket-apply$ operator expression ...).
Next: Hash-prefixed forms, Previous: Lexical syntax, Up: Syntax [Contents][Index]