Human-inclined data (HID) syntax

Genode uses its custom designed human-inclined data (HID) format as configuration syntax.

Human-inclined data (HID) format

https://genode.org/documentation/hid

Structurally, HID mirrors the concepts of XML. Data is expressed as a hierarchy of nodes where each node can have attributes. Like XML, data can be validated against a schema. Syntactically, however, HID promotes calmness and clarity. There are no quoting characters, no quoting rules, no keywords, and no braces. Its few syntactic rules allow for both tabular or tree-like expression of data, thereby fostering a literate configuration style. The remainder of this section gives a brief overview of the syntax. Further details and information about tooling are available at the online documentation linked above.

Structure

HID consists of a single top-level node that starts with its node type and is closed by a - marker. The node type and the end marker appear at separate lines.

 config
 -

A node can host sub nodes denoted by a leading + followed by a space. Further nesting requires at least two leading spaces for each nesting level.

 config

 + default-route
   + any-service
     + parent
     + any-child
 -

In the example, default-route is a sub node of config, any-service is a sub node of default-route, and parent as well as any-child are sub nodes of any-service.

Node names

A node can have a name that appears after the node type, separated by space.

 config

 + default-route
   + any-service
     + parent
     + any-child

 + start osci
 -

In the example, the start node is named "osci".

Attributes

A node can have tag-value attribute definitions. Each attribute definition consists of a tag followed by a colon and space followed by its value, and appears at a separate line indented at least at the level of its node.

 config
        verbose: yes
        arch:    x86_64

 + default-route
   + any-service
     + parent
     + any-child

 + start osci
   ram: 8M
   pkg: nfeske/pkg/rom_osci/2025-12-12
 -

In the example, verbose and arch are attributes of the config node whereas ram and pkg are attributes of the start node. Note that the indentation gives a little room for creative freedom. The attributes of config are indented in a roomy way whereas the start attributes appear more densely.

Technically, a node name is merely a shorthand for the value of a node's name attribute.

Compacted lines

Two subsequent lines can be merged into one using | as delimiter whenever the indentation of the second line is higher than the first line.

For example,

 config
        verbose: yes
        arch:    x86_64

could be written as

 config
          verbose: yes
                         arch: x86_64

or in the compacted form

 config | verbose: yes | arch: x86_64

The | character splits one line into multiple segments where each segment denotes a separate line with its indentation retained from the segment. Note that | delimits the preceding attribute value. Hence, | characters cannot appear in attribute values.

Tabular arrangement

The merging of lines can be leveraged for compacting nested nodes.

For example,

 + route
   + service ROM
     label: recording
     + child record_rom
   + service Gui
     + child wm
   + any-service
     + parent

could be written as

 + route
   + service ROM
                   label: recording
                                      + child record_rom
   + service Gui
                                      + child wm
   + any-service
                                      + parent

and thus can be compacted to

 + route
   + service ROM | label: recording | + child record_rom
   + service Gui                    | + child wm
   + any-service                    | + parent

This tabular style conveys well the from-to relationship between the outer service nodes and the routing targets given as inner node.

Visual scoping

At the beginning of a line, | characters effectively split emptiness into empty segments, which do not have any meaning. Without meaning, however, they give room for creative freedom, in particular for reinforcing the notion of scope.

 config | verbose: yes | arch: x86_64
 .
 .
 .
 + start osci | ram: 8M | pkg: nfeske/pkg/rom_osci/2025-12-12
   + config
   |        fps:        50
   |        phase_lock: no
   |        width:      720
   |        background: #1a2831
   |        color:      #ffefdf
   |
   | + channel | label: mic_left  | color: #ff6633 | v_pos: 0.25
   | + channel | label: mic_right | color: #cc7777 | v_pos: 0.75
   + route
     + service ROM | label: recording | + child record_rom
     + service Gui                    | + child wm
     + any-service                    | + parent
 -

In the example, the attributes of the inner config node stand out as most prominent. They are deliberately being laid out in a form-like fashion to invite tweaking. In contrast, the channel nodes benefit from a tabular style of attribute definitions. The scope of the inner config is clarified by using leading | characters, which also happens to give the sibling node route a visual anchor point.

Comments

Lines starting with a . followed by a space are comments describing the preceding node or attribute. Comments capture the entire line. So any character including | can appear in comments.

 + start osci | ram: 8M | pkg: nfeske/pkg/rom_osci/2025-12-12
   .
   . Oscilloscope that visualizes time-series values obtained from a
   . ROM session labeled 'recording'
   .
   + config
   |        fps:        50
   |        phase_lock: no    | . use 'yes' for more stability
   |        width:      720
   |        background: #1a2831
   |        color:      #ffefdf
   .
   .

In the example, a multi-line comment explains the purpose of the start node whereas a trailing comment - separated by the | delimiter - annotates the phase_lock attribute.

Quoted content

Textual data of any form can be embedded in a node by prepending each line with a : character. Content must be separated from the : character with a single space.

 + arg bash | . command name presented in argv[0]
 + arg -c
   : while true; do
   :  read -p '> ' -e; history -s $REPLY; pcalc $REPLY;
   : done

 + env TERM  | : screen
 + env PATH  | : /bin
 + env SHELL | : bash
 + env HOME  | : /

In the example, a multi-line command is passed as -c argument to a bash shell whereas the compacted form is used to express the values of environment variables. Like a comment, quoted content captures the entire line including | characters. The script passed as -c argument could use pipes.

Disabled sub nodes

A sub node can be disabled by replacing the leading + by an x. This has an effect similar to commenting-out the entire node and its sub structure.

 x arg -c
   : while true; do
   :  read -p '> ' -e; history -s $REPLY; pcalc $REPLY;
   : done

In the example, the -c argument would be omitted.