Honu is a family of languages built on top of MzScheme. Honu syntax resembles Java, instead of Scheme. Like Scheme, however, Honu has no fixed syntax. Honu supports extensibility through macros and a base syntax of H-expressions, which are analogous to S-expressions.

The MzScheme reader incorporates an H-expression reader, and MzScheme's printer also supports printing values in Honu syntax. The reader can be put into H-expression mode either by including #hx or #honu in the input stream, or by calling read-honu or read-honu-syntax instead of read or read-syntax:

Similarly, print56 produces Honu output when the print-honu parameter is set to #t.

When the reader encounters #hx, it reads a single H-expression, and it produces an S-expression that encodes the H-expression. Except for atomic H-expressions, evaluating this S-expression as Scheme is unlikely to succeed. In other words, H-expressions are not intended as a replacement for S-expressions to represent Scheme code.

When the reader encounters #honu, it reads H-expressions repeatedly until an end-of-file is encountered. The collected H-expression results are wrapped with (module id (lib "honu-module.ss" "honu-module") ....), where id is generated as described below. The honu-module.ss module defines #%module-begin to parse S-expressions that encode H-expressions; expanding the module produces a Scheme program that corresponds to the H-expression-based Honu program in the original input stream. Thus, a file that starts with #honu can define a module to be required in a Scheme module or another Honu module.

In the module wrapper for #honu, the id is derived from the read port's name: if the port's name is a symbol, then it is used as id; if the port's name is a path, then the last element of the path is converted to a symbol and used as id; otherwise, 'unknown is used.

The honu-module.ss module and Honu language dialects are documented elsewhere. In principle, MzScheme's parsing and printing of H-expressions is independent of the Honu language, so it is currently documented here.

19.1  Honu Input Parsing

Ignoring whitespace, an H-expression is either

Whitespace for H-expressions is as in Scheme: any character for which char-whitespace? returns true counts as a whitespace.

19.1.1  Numbers

The syntax for Honu numbers is the same as for Java. The S-expression encoding of a particular H-expression number is the obvious Scheme number.

19.1.2  Identifiers

The syntax for Honu identifiers is the union of Java identifiers plus semicolon (;), comma (,), and a set of operator identifiers. An operator identifier is any combination of the following characters:

   + - _ = ? : < > . ! % ^ & * / ~ |

The S-expression encoding of an H-expression identifier is the obvious Scheme symbol.

Input is parsed to form maximally long identifiers. For example, the input int->int; is parsed as four H-expressions: int, ->, int, and ;.

19.1.3  Strings

The syntax for an H-expression string is exactly the same as for an S-expression string, and an H-expression string is represented by the obvious Scheme string.

19.1.4  Characters

The syntax for an H-expression character is the same as for an H-expression string that has a single content character, except that a single quote (') surrounds the character instead of double quotes ("). The S-expression representation of an H-expression character is the obvious Scheme character.

19.1.5  Parentheses, Brackets, and Braces

A parenthesized (), bracketed [], or braced {} H-expression sequence is represented by a Scheme list. The first element of the list is '#%parens for a paremnthesized sequence, '#%brackets for a brackets sequence, or '#%braces for a braced sequence. The remaining elements are the Scheme representation for the parenthesized, bracketed, or braced H-expressions in order.


An H-expression comment starts with either // or /*. In the former case, the comment runs until a linefeed or return. In the second case, the comment runs until */, but /* .... */ comments can be nested. Comments are treated like whitespace.

A #; starts an H-expression comment, as in Scheme. It is followed by an H-expression to be treated as white. Note that #; is equivalent to #sx#;#hx.

19.2  Honu Output Printing

Some Scheme values have a standard H-expression representation. For values with no H-expression representation but with a readable S-expression form, the MzScheme printer produces an S-expression prefixed with #sx. For values with neither an H-expression form or a readable S-expression form, then printer produces output of the form #<...>, as in Scheme mode.

The values with H-expression forms are as follows:

56 More precisely, the default print handler.