On this page:
8.1 Reading Numbers
8.2 Reading Symbols
8.3 Reading Strings
8.4 Reading Lists
8.5 Reading Booleans
8.12

8 Zuo S-Expression Reader🔗ℹ

The Zuo reader recognizes a subset (roughly) of Racket S-expression notation. The reader works in terms of bytes as characters, not Unicode. It reads and potentially recurs based on a starting character sequence after skipping ASCII whitespace characters:

 

 

;

 

starts a line comment

 

 

#!

 

starts a line comment; \ at then end of a line to the next

 

 

#;

 

comments out the next S-expression

 

 

(

 

starts a pair or list; see Reading Lists

 

 

[

 

starts a pair or list; see Reading Lists

 

 

.

 

creates a pair when delimited afterward; see Reading Lists

 

 

"

 

starts a string; see Reading Strings

 

 

#"

 

starts a string; see Reading Strings

 

 

#t

 

starts a boolean; see Reading Booleans

 

 

#f

 

starts a boolean; see Reading Booleans

 

 

'

 

creates a list with quote and the next S-expression

 

 

`

 

creates a list with quasiquote and the next S-expression

 

 

,

 

creates a list with unquote and the next S-expression

 

 

,@

 

creates a list with unquote-splicing and the next S-expression

A # followed by any other character is not allowed. Other starting character sequences either create a number (see Reading Numbers) or symbol (see Reading Symbols), or they are disallowed. Any character that is not allowed with a symbol (see Reading Symbols) counts as a delimiter.

8.1 Reading Numbers🔗ℹ

A Zuo number starts optionally - and then one or more decimal digits. It must be delimited afterward. The resulting integer must fit into a 64-bit two’s complement representation. Any number of leading 0s is allowed.

Zuo does not support floating-point numbers, and it does not allow + at the beginning of a number. Such sequences will parse as symbols.

8.2 Reading Symbols🔗ℹ

A symbol can include any ASCII digit, alphabetic character for the following characters:

 

 

~

 

!

 

@

 

#

 

$

 

%

 

^

 

&

 

*

 

-

 

_

 

=

 

+

 

:

 

<

 

>

 

?

 

/

 

.

Although # is allowed within a symbol, a symbol cannot start with #. A sequence that optional starts - with one or more digits up to a delimited is parsed as a number (see Reading Numbers) instead of a symbol. A delimited . is not a symbol.

8.3 Reading Strings🔗ℹ

A string starts with #" or " and ends with a matching ". Any character is allowed in a string, except for a newline or return character. The following escapes are supported with the usual meaning: \", \\, \n, \r, \t, and \ followed by one to three octal digits.

8.4 Reading Lists🔗ℹ

An ( or [ starts a list or pair that runs until the matching ) or ], respectively. S-expressions between the matching pair are the elements of the list or pair. If a delimited . appears where a list element is expected, then exactly one S-expressioon must appear afterward within the matching pair.

8.5 Reading Booleans🔗ℹ

A boolean is #t, #f, #true, or #false, and it must be followed by a delimiter. Any other sequence after #, other than a string or line comment, is an error.