A | |
annot [Atd_ast] |
An annotation, consisting of a sequence of sections.
|
annot_field [Atd_ast] |
An annotation field,
i.e.
|
annot_section [Atd_ast] |
represents a single annotation within edgy brackets.
|
C | |
cell [Atd_ast] |
Tuple cell.
|
F | |
field [Atd_ast] |
A single record field or an
inherit statement.
|
field_kind [Atd_ast] |
Different kinds of record fields based on the
`Required : required field, e.g. id : string , `Optional : optional field without a default value, e.g.
?name : string option . The ATD type of the field
value must be an option type., `With_default : optional field with a default value, e.g.
~websites : string list . The default value may be implicit
or specified explicitely using annotations.
Each target language that cannot omit fields
may have to specify the default in its own syntax.
Sample ATD file:
type level = [ Beginner | Advanced | Expert ] type user = { id : string; ?name : string option; (* Field may be omitted when no value is set, if permitted by the target language. *) ~websites : string list; (* Implicit default: empty list. Field may be omitted if the field value is equal to the default value and the target language permits it. *) ~level <ocaml default="`Beginner"> : level; (* Explicit default for `ocaml'. For instance there is no `json' annotation because the default for undefined `JSON' fields would be to omit them. *) } |
full_module [Atd_ast] |
Contents of an ATD file.
|
L | |
loc [Atd_ast] |
A location in the source code.
|
M | |
module_body [Atd_ast] |
The body of an ATD file is a list of type definitions.
|
module_head [Atd_ast] |
The head of an ATD file is just a list of annotations.
|
module_item [Atd_ast] |
There is currently only one kind of module items,
that is single type definitions.
|
T | |
t [Atd_indent] | t is the type of the data to be printed.
|
t [Atd_annot] |
Sample annotation in ATD syntax with legend:
section a section b ----------- ------ <a a1="x1"> <b b1> | | | | | | | +- field without a value | | | | | +- field value | | | +- field name | +- section name |
type_def [Atd_ast] |
A type definition.
|
type_expr [Atd_ast] |
A type expression is one of the following:
`Sum : a sum type (within square brackets), `Record : a record type (within curly braces), `Tuple : a tuple (within parentheses), `List : a list type written list with its parameter
e.g. int list , `Option : an option type written option with its parameter
e.g. string option , `Shared : values for which sharing must be preserved. Such
type expressions may not be parametrized. Values may only
be shared if the source location of the type expression is the same., `Name : a type name other than list or option , including
the predefined types unit , bool , int , float , string
and abstract ., `Tvar : a type variable identifier without the tick
|
type_inst [Atd_ast] |
A type name and its arguments
|
type_param [Atd_ast] |
List of type variables without the tick.
|
V | |
variant [Atd_ast] |
A single variant or an
inherit statement.
|