On this page:
2.1 Tokens
2.2 Structure
honu-read
honu-read-syntax
honu-lexer

2 Reader

2.1 Tokens

The Honu reader, honu-read, will tokenize the input stream according to the following regular expressions.

Comments can be written for a single line or in block form. Use # or // for a line comment and /* */ for block comments. Block comments can be nested.

# i am a comment

// i am also a comment

/* start of a comment /* with an inner comment */ end of first comment */

2.2 Structure

 (require honu/core/read) package: honu

After tokenization a Honu program will be converted into a tree with minimal structure. Enclosing tokens will be grouped into a single object represented as an s-expression. Enclosing tokens are pairs of (), {}, and [].

Consider the following stream of tokens

x ( 5 + 2 )

This will be converted into
(x (#%parens 5 + 2))

{} will be converted to (#%braces ...) and [] will be conveted to (#%brackets ...)

procedure

(honu-read port)  any

  port : port?
Read an s-expression from the given port.

procedure

(honu-read-syntax name port)  any

  name : any
  port : port?
Read a syntax object from the given port.

procedure

(honu-lexer port)  (list position-token?)

  port : port?
Tokenize a port into a stream of honu tokens.