Reader Grammar

The reader grammar defines whitespace/comments, identifiers, booleans, characters, strings, numeric tokens, lists, vectors, bytevectors, and quotation prefixes.

Current guarantees

  • Integer: -?(0|[1-9][0-9]*); rational: integer numerator over positive canonical denominator; real requires fraction or exponent.
  • Dotted-list placement, escape spelling, byte range, and delimiter closure are checked before normalization.
  • Source spans use the reader input identity and deterministic positions.

Pinned token grammar

TokenAccepted shapeRejected boundary
integer-?(0|[1-9][0-9]*)leading zero, radix/exactness prefix
rational<integer>/[1-9][0-9]*; reduced after readzero/negative denominator spelling, leading-zero denominator
realdecimal with fraction and/or exponentbare integer ambiguity, non-finite literal
character#\<scalar> or pinned named forminvalid scalar or incomplete escape
bytevector#u8(<byte> ...)element outside 0..255

Boundaries

  • Reader extensions not listed in the profile fail loudly.