[antlr-interest] gUnit for v4?
David.Meibusch at csgi.com
Mon Apr 30 19:38:56 PDT 2012
I can layout out our use case, just to see if it confirms your
We have an ANTLR v3 combined grammar for an existing proprietary
language. The language is implemented elsewhere in the company, bespoke
in C/C++, and never previously had/has a grammar.
This grammar is used to generate Java ASTs for our Eclipse-based IDE
editor plugins. The grammar heavily uses actions and has all manner of
weird and wonderful predicates to workaround some of the peculiarities
of the language. The language parser/interpreter is still
developed/maintained in C/C++ by another team - our team just follow
their lead with our own parser.
We have several thousand gunit tests that form our regression suite.
I forked my own gunit sometime ago, creating a new gunit-maven-plugin
(note following the Maven 3 naming convention for non-Apache plugins).
This Maven plugin uses the Maven surefire framework to launch and run
the tests, so you get junit result XML files. This integrates with our
Jenkins continuous integration server.
The gunit grammar has also evolved, with some cleaned up syntax and
OK/FAIL, same as before
RETURN[<name>] allows you to test a rule return by name
OUTPUT (or ->) allows you to test the parse tree created with no parse
ERROR allows you to test the parse tree with error nodes expected
Note that error reporting and recovery is particularly important - in
fact close to the entire rationale for this parser's existence.
Pretty much all aspects of the parser's operation can then be tested
with simple single (mostly) line tests in gunit files.
In running the tests, they are expected to catch:
1) Changes in ANTLR itself after version upgrades (each v3 minor
version of ANTLR has changed at least something, mostly for good...but
2) Regressions in output or error handling when adding/changing
the grammar to reflect external changes to the language
3) Similarly, regressions as we (often) try to improve the error
handling and recovery logic.
Since the move to github, I really have no excuse now not to contribute
this plugin back to the project...if anyone is interested.
All emails in this message string and any attachments are the confidential information of CSG Systems International, Inc. (CSG), or its affiliates and subsidiaries, and may contain privileged and/or confidential material. If you are not an intended recipient, please delete it immediately and notify the sender; unintended recipients are not authorized to read or otherwise use the information contained herein.
More information about the antlr-interest