Syntax Specification
The normative specification of the ADL syntax is expressed in Antlr4 as a series of component grammars, shown below. This has been tested with the Antlr4.5 implementation available from Antlr.org. The source files are available in two locations on Github - ADL Antlr files; Common Antlr files. Note that the ODIN grammar used in parts of an ADL archetype is not shown below, it can be found in the ODIN specification [openehr_odin].
There are various other syntax specifications in existence.
The ADL Workbench currently implements a version of the ADL2 language and syntax expressed in traditional yacc/lex specifications, with the .y and .l files are found in the following locations:
The above grammars are complete and more heavily tested, but due to being in an older technology, not easily re-usable by other languages, or by LL(*) parser generators like Antlr, since they contain various LR (left recursive) constructs.
An Antlr3 grammar specification also exists and is used in the current Java implementation of AOM2/ADL2.
ADL Outer Syntax
The following grammar expresses the outer syntax of ADL, i.e. the top-level structure of section keywords and initial identification lines in an ADL text.
Unresolved directive in syntax_spec.adoc - include::{grammar_dir}/adl.g4[]
cADL Syntax
The following grammar expresses the syntax of cADL composite types, i.e. the language of the definition section of an archetype.
Unresolved directive in syntax_spec.adoc - include::{grammar_dir}/cadl.g4[]
cADL Primitives Syntax
The following grammar defines the syntax of cADL primitives, which are used by cADL composites and also by ADL rules.
Unresolved directive in syntax_spec.adoc - include::{grammar_dir}/cadl_primitives.g4[]
Rules Syntax
The following grammar defines the syntax that may appear in the rules section of an archetype and also the assertions in Archetype slots.
Unresolved directive in syntax_spec.adoc - include::{grammar_dir}/adl_rules.g4[]
ADL Keywords
The following grammar defines the lexer patterns for ADL keywords.
Unresolved directive in syntax_spec.adoc - include::{grammar_dir}/adl_keywords.g4[]
ODIN value types
The following grammar defines the syntax for the terminal types in ADL, which are derivde from ODIN.
Unresolved directive in syntax_spec.adoc - include::{grammar_dir}/odin_values.g4[]
Base Patterns
The following grammar defines syntax of generic base patterns.
Unresolved directive in syntax_spec.adoc - include::{grammar_dir}/base_patterns.g4[]