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.
|
B | |
block [Atd_doc] | `Paragraph is a regular paragraph.
|
C | |
cell [Atd_ast] |
Tuple cell.
|
D | |
doc [Atd_doc] |
A document is a list of paragraph-like blocks.
|
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.
|
I | |
inline [Atd_doc] | `Text is regular text.
|
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.
|
O | |
original_types [Atd_expand] |
To support the generation of annotations for types that are created
during the monomorphization process, a mapping must be kept connecting
the monomorphic type name to the original polymorphic one, including its
original number of parameters.
|
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 , `Nullable : adds a null value to a type.
`Option should be preferred over `Nullable since
it makes it possible to distinguish Some None from None ., `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., `Wrap : optional wrapping of a type. For example, a timestamp
represented as a string can be wrapped within a proper time type.
In that case, the wrapper would parse the timestamp and convert
it into the internal representation of its choice. Unwrapping
would consist in converting it back to a string., `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.
|