AQL ANTLR4-grammar

Thomas Beale thomas.beale at
Mon Aug 24 22:12:38 EDT 2015

On 24/08/2015 11:38, Bert Verhees wrote:
> On 24-08-15 15:36, Thomas Beale wrote:
>> Antlr4 rule capabilities and particularly pattern matching is weaker 
>> than yacc/lex (in some cases quite a lot weaker),
> Of course, Yacc/lex can only be used to generate C-code. It's 
> functionality in pattern matching is limited to this.

nope - it can be used to generate anything (I use it to generate Eiffel 
code). The point is it can only generate 1 language.

> To do whatever you need to do, writing a compiler, translating 
> programming languages into another (transpiler), translating a query 
> language into another, processing data, JSON,. XML, CSV, to many 
> custom made targets, generated code accessible to choose for a 
> listener/visitor or tree pattern, and having scoped symbol tables, 
> that  is where Antlr comes in.

actually - these are all output stages, and they are perfectly doable 
with any yacc/lex compiler serialiser - which is what the ADL workbench 
is, and what it does. Antlr des make a lot of this easier however.

> Maybe the weakness is C-related? It is what one expects because the 
> nature of Yacc/lex.

yacc/lex grammars have nothing to do with C - they work the same way 
with any language.

The weaknesses are mainly in the regex matching for string patterns - 
Antlr doesn't do anything like full regex. Its stateful sub-grammar 
handling needs a bit of work as well.

But I agree, it's probably the future, at least for a while.

- thomas

More information about the openEHR-technical mailing list