Skip to main content

Annotation Declaration



Declare an annotation type for nodes. This feature is deprecated; please use keyword fields instead.


anno AnnoType OnType @ Name


An annotation may be associated with any node value, be it a pure node or some Algebraic Data Type derived from it.

Annotations are intended to attach application data to values, like adding position information or control flow information to source code or adding visualization information to a graph.

An annotation declaration defines:

  • AnnoType, the type of the annotation values,
  • OnType, the type of the values that are being annotated,
  • Name, the name of the annotation.

Any value of any named type can be annotated and the type of these annotations can be declared precisely.

The following constructs are provided for handling annotations:

  • Val @ Anno: is an expression that retrieves the value of annotation Anno of value Val (may be undefined!).

  • Val₁[@Anno = Val₂]: is an expression that sets the value of annotation Anno of the value Val₁ to Val₂ and returns Val₁ with the new annotation value as result.

  • Var @ Anno = Val: is an assignment statement that sets the value of annotation Anno of the value of variable Var to Val.


Examples have been removed since this feature is deprecated.


  • Annotations are cumbersome since they change the structure of Values without changing the semantics of the identity of a value. This is why they are deprecated.