[antlr-interest] Replacement of language specific actions with a general language?

Johannes Luber jaluber at gmx.de
Sat Mar 17 09:22:31 PDT 2007


I've read about Terrance's project regarding grammar comparison, which
got me thinking. The problem is that, while there is a unique grammar
definition language (UGDL), that this UGDL doesn't cover implementation
issues. Those implementation issues result in separating one single
grammar into several ones, depending on the number of implementation

The obvious solution is to define a companion language or a simple
extension to the UGDL, which is subsequentially translated into language
constructs of the target language. So far I can see only two problems
with this approach (to burden target developers with more work may be a
disadvantage, but isn't a problem):

The first one is the expressiveness of the extension. The language needs
to support enough constructs that the implementation isn't more
difficult than the use of the target language itself. I suppose that the
more experienced grammar developers can come up with a list of features.
It is probable that the features are the common subset of the available
language features to allow easier translation, but it would still result
that new features of target languages won't show up in the extension
language. How much this actually hurts grammar implementations I cannot say.

Furthermore, this leads directly to the second problem. If this
extension language is object-orientated, procedural implementations may
not be able to replicate all the features fully. At least there has to
be support for linked lists or other used data structures, so if the
target language doesn't offer native support the ANTLR runtime
implementer has to write such support himself.

The alternative is to rely on a procedural extension language. It is
easy to simulate procedural programming in an OO-environment (if no
global variables and functions aren't available, use class scope as
global scope replacement), but developers probably won't like it to be
restricted like that (at least I wouldn't like it).

In conclusion, do those problems constitute large enough hindrances that
an extension to the UGDL would be infeasible compared to the todays
situation? Did I overlook problems?

Best regards,
Johannes Luber

More information about the antlr-interest mailing list