Module reader

Source
Expand description

The OftLisp reader.

Note that this is typically known as a parser, but Lisp tradition is to refer to the parser for the language as “the reader”, especially when it does not perform advanced processing (e.g. macro expansion) automatically.

The grammar of OftLisp is:

value = { comment }, byteString
      | { comment }, string
      | { comment }, symbolish
      | { comment }, "(", { value }, ")"
      | { comment }, "(", value, { value }, "\u{2022}", value ")"
      | { comment }, "[", { value }, "]"
      | { comment }, readerMacro, { comment }, value;
comment = ";", { ? all characters ? - "\n" }, "\n";
byteString = "b", '"', { stringChar }, '"'
string = '"', { stringChar }, '"'
symbolish = symbolChar, { symbolChar }
stringChar = ? all characters ? - ( "\\" | '"' )
           | "\\", escape;
escape = "a" | "b" | "e" | "n" | "r" | "t" | '"'
       | "x", hex, hex
       | "u", hex, hex, hex, hex
       | "U", hex, hex, hex, hex, hex, hex, hex, hex;
hex = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
    | "a" | "b" | "c" | "d" | "e" | "f"
    | "A" | "B" | "C" | "D" | "E" | "F";
symbolChar = ? an ASCII letter ?
           | ? an ASCII digit ?
           | "+" | "-" | "." | "/" | "$" | "?" | "*" | "#" | "=" | "<"
           | ">" | "_";
readerMacro = "'" | "`" | ",@" | ",";

Modules§

lexer
The lexer for the OftLisp reader.
symbolish
Utilities for parsing a “symbolish” lexeme.

Structs§

ReadError
An error that occurs while reading.
SourceLocation
The location of an error (or of anything else).

Enums§

AcceptSet
A set of acceptable characters.
ReadErrorKind
The kind of the error.

Functions§

read_file
Reads zero or more Values from a file.
read_many
Reads zero or more Values.
read_one
Reads a single Value from the lexer.