[antlr-interest] ASTFrame usage?

Ric Klaren ric.klaren at gmail.com
Thu Jul 21 07:35:38 PDT 2005


On 7/21/05, Paul Johnson <gt54-antlr at cyconix.com> wrote:
> I'd like to use ASTFrame with C++, if possible, but first I'm trying to
> get a Java example to work. However, I know almost exactly nothing about
> Java, and I've spent a couple of hours trying to get the example in the
> manual working:

Hmmm dunno how easy it is to spawn a piece of java UI from a C++ process.

> > public static void main(String args[]) {
...<snip>
> > }
> 
> Could someone please manage an idiot's guide to making this code do
> something? So far, I've turned it into:
> 
> ----------------------------------
> import antlr.ASTFactory;
> import antlr.CommonAST;
> import antlr.ASTFrame;

You got the wrong namespace:

import antlr.debug.misc.ASTFrame;

If you happen to have eclipse running then using that for java stuff
makes life a bit easier. Although it might stop you from really
getting to know what you're doing.

> javac main.java -classpath path-to-antlr/lib/antlr.jar

That should be ok I think.

> Then java 1.5 tells me that it can't import antlr.ASTFrame ("cannot find
> symbol"). I can't compile with 1.4 at all ("class file has wrong version
> 49.0, should be 48.0").

For the 1.4 stuff you'd probably have to rebuild the antlr.jar with
JDK 1.4 (or add for 1.5 the options to make 1.4 compatible stuff)

Cheers,

Ric


More information about the antlr-interest mailing list