[antlr-interest] gUnit for v4?

Oliver Zeigermann oliver.zeigermann at gmail.com
Sun Apr 15 14:40:13 PDT 2012

Am 15.04.2012 23:36 schrieb "Terence Parr" <parrt at cs.usfca.edu>:

> Hi,
> I started down the path of building the new version of gUnit for v4, but
> I'm beginning to question its value for the new version. Because I am
> pooh-poohing putting actions directly within a grammar, grammar can only
> yield parse trees. and looks nice to be able to say:
> expr:
>        "1"             -> (expr 1)
>        "1+2"   -> (expr (expr 1) + (expr 2))
> but so what? all that did was confirm that the parser generated by ANTLR
> works correctly. it's not telling you anything you didn't know by looking
> at the grammar.
> In the old days we used to build ASTs and so we needed to check the
> structure. That need is no longer here. Also, these rules don't generate
> output and so we can't check input to output translation.
> What it comes down to is this: we really need functional testing not unit
> testing for language applications, unless of course each rule returns a
> string that the translation of the input some phrase or something. But,
> it's just as easy to write calls to assertEquals() saying that input x
> should yield input y. If we are doing something other than generating
> output, such as building up a data structure, then we really do need to
> manually check that the data structure is solid given some input.
> I'm trying to find a flaw in my logic. Is there something I'm missing
> about testing grammars? In v4, they will give you exactly what you want,
> unless there is a bug in ANTLR. But that's my problem not yours.
> If we can't find a major benefit, then we should avoid introducing another
> moving part to the ANTLR ecosystem.
> Ter
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address

More information about the antlr-interest mailing list