[antlr-interest] Transformation to new grammar
Bryan Ewbank
ewbank at gmail.com
Mon Aug 15 09:26:19 PDT 2005
I'm taking a stab in two directions here - hope one of them is correct :-)
If you're talking about tracking which parts of the tree are complete,
you can use a marker in the AST to know which version a specific node
is. E.g.
blah: #(op:AAA b c d) { ... #op->level++; };
If you're talking about testing/validating your translator, you could
output your result then attempt to compile it with the "official"
interpreter. Something like this, from the command line:
# given test_xxx.in, convert to test_xxx.res, then compile it...
myConvert -o test_xxx.res test_xxx.in > test_xxx.out 2> test_xxx.err
officialCompile test_xxx.res > test_xxx.oc_out 2> test_xxx.oc_err
The input file, and each of the four output files can be stored for
reference and reuse; once you have a solid baseline, you can eliminate
the officialCompile testing from routine regression testing - but make
sure it's still used regularly.
On 8/15/05, Barry McGillin <barry.mcgillin at oracle.com> wrote:
> I have a grammar for one version of SQL that I'm mapping into Oracle SQL.
> ...
> Today, we can walk the source tree and make transformations to it to move us from
> tree 1 towards tree n, but when do we know we're finished and correct? I'm not looking
> for a specific solution, but rather some ideas about how this can be done efficiently
> if at all :-)
More information about the antlr-interest
mailing list