Syntax Specification
The normative specification of the ADL1.4 syntax is expressed in Antlr4 as a series of component grammars, shown below. This has been tested with the Antlr 4.9 implementation available from Antlr.org. The source files are available in two locations on Github - adl-antlr repository. The ODIN grammar used in parts of an ADL archetype is not shown below, it can be found in the openEHR ODIN specification.
| this form of Antlr grammars is non-modal and mixed (i.e. parsers and lexers in same files). This will be changed in the next version to separated files and modal lexing, to deal better with ODIN embedded in ADL and related issues. |
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 include directive in modules/ADL1.4/pages/syntax_spec.adoc - include::https://raw.githubusercontent.com/openEHR/adl-antlr/refs/heads/master/src/main/antlr/adl/adl14.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 include directive in modules/ADL1.4/pages/syntax_spec.adoc - include::https://raw.githubusercontent.com/openEHR/adl-antlr/refs/heads/master/src/main/antlr/adl/cadl14.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 include directive in modules/ADL1.4/pages/syntax_spec.adoc - include::https://raw.githubusercontent.com/openEHR/adl-antlr/refs/heads/master/src/main/antlr/adl/cadl14_primitives.g4[]
ADL Keywords
The following grammar defines the lexer patterns for ADL keywords.
Unresolved include directive in modules/ADL1.4/pages/syntax_spec.adoc - include::https://raw.githubusercontent.com/openEHR/adl-antlr/refs/heads/master/src/main/antlr/adl/adl_keywords.g4[]
Base Expressions
The following grammar defines syntax of expressions.
Unresolved include directive in modules/ADL1.4/pages/syntax_spec.adoc - include::https://raw.githubusercontent.com/openEHR/adl-antlr/refs/heads/master/src/main/antlr/adl/base_expressions.g4[]
Base Lexer
The following grammar defines common lexical entities.
Unresolved include directive in modules/ADL1.4/pages/syntax_spec.adoc - include::https://raw.githubusercontent.com/openEHR/adl-antlr/refs/heads/master/src/main/antlr/adl/base_lexer.g4[]