ADL 2 parser resources

ADL 1.5 tools require lexical scanners and parsers for ADL, as well as serialisers. A set of these is available for the reference compiler, with other versions appearing. We don't consider the grammars normative, since different grammars or production rules may be more or less efficient depending on the kind of parser. The normative specification is ADL itself.

 Reference Compiler 

The grammar files shown below are from the Eiffel reference compiler. They are shown in pure rule form (i.e. just the production rules, no code), and in the typical .y file form containing code, which gives an idea of what each rule does in the current parsers. NOTE: there is no guarantee that these grammars are the best possible for the syntax, and they are currently made for LALR parsers and will probably need adjustment to work for LL(k) parser tools like Antlr. We are actively looking into this.

ADL is a composite syntax, and uses 4 syntaxes.



Production rules

Lexer - 
.l file (Eiffel)

Parser - 
.y file (Eiffel)


The 'outer' syntax: corresponding to the keywords and top-level structure of a file. This will revert to dADL one day, but since it's friendly and easy to read, and everyone seems to like it, it seems we will stick with it a while longer.





The primary constraint syntax of archetypes, characterised by curly brackets. Used to express the core formal constraint semantics of an archetype or template.





The assertion syntax of archetypes. Used to express archetype-wide (i.e. cross-attribute) constraints and also archetype slot constraint conditions. This syntax is essentially a simplified variant of XPath.

(embedded in cadl)

(embedded in cadl)

(embedded in cadl)


openEHR's native object serialisation syntax. This syntax is used for all 'data' sections of an ADL archetype, including the description, languages, ontology and annotations sections.





Other Tool Grammars

Swansea University (Athanasios Anastasiou )

A first version of ADL and cADL expressed in EBNF and ANTLR's meta-language is now avaialble at:
The ANTLR definitions specifically are available at:

In general, transcribing from: was a straightforward task for the majority of the rules.