[antlr-interest] Re: JavaTreeParser? What does it do?
jw9315
jw9315 at bris.ac.uk
Mon Apr 28 17:48:35 PDT 2003
Hi,
yeah, sorry I did see that linkm but I'm new to this and didn't quite
understand. What I'm trying to do is build an interpreter for a
*small* subset of the Java language. I ran the example in the Java
grammars folder to give me a nice AST tree for any program I type in
at the command line, and was planning on parsing and interpreting the
program using the method calls such as .getChild().
What I was confused about is the fact that I call such as "AST myAST
= r.getFirstChild();", but what is the difference between this and
the line "JavaTreeParser tparse = new JavaTreeParser();". I can't
understand what you can do differently with the two different
commands! Sorry if this is a really stupid question but if there's a
short answer that anyone's willing to give I would be glad to hear it.
Thanks,
Jon
--- In antlr-interest at yahoogroups.com, Terence Parr <parrt at j...>
wrote:
> Hi. Have you checked the faq entry that answers your question?
>
> http://www.jguru.com/faq/view.jsp?EID=818959
>
> It's called: What is a tree parser and why would I want to use one?
>
> <snicker>
>
> Terence
>
> On Monday, April 28, 2003, at 10:17 AM, jw9315 wrote:
>
> > Hi,
> > I'm a brand new ANTLR user. I'm using the AST tree it produces to
> > create an interpreter for a small subset of the Java programming
> > language. I was looking at the Main.java file in the grammar
examples
> > directory, and one of the last lines says:
> > '
> > JavaTreeParser tparse = new JavaTreeParser();
> > try
> > {
> > tparse.compilationUnit(t);
> > System.err.println("successful walk of result
> > AST for "+f);
> > }
> > catch (RecognitionException e) {
> > System.err.println(e.getMessage());
> > e.printStackTrace();
> > }
> > ' Could anyone tell me what this block does in the program, what
is
> > a JavaTreeParser?
> > Thanks,
> > Jon
> >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> --
> Co-founder, http://www.jguru.com
> Creator, ANTLR Parser Generator: http://www.antlr.org
> Co-founder, http://www.peerscope.com link sharing, pure-n-simple
> Lecturer in Comp. Sci., University of San Francisco
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list