aspose file tools*
The moose likes Java in General and the fly likes Syntax Tree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Syntax Tree" Watch "Syntax Tree" New topic
Author

Syntax Tree

Hunter McMillen
Ranch Hand

Joined: Mar 13, 2009
Posts: 492

Hey everyone,

I'm wrote a recursive descent parser for a project im working on and now I need to create a syntax tree using that parser. I'm not really familiar with any of the tree classes in the java api. So I was wondering what everyone thought would be a good choice. I have node classes that I have written myself. All of my nodes extend from my Node superclass.

Thanks,
Hunter


"If the facts don't fit the theory, get new facts" --Albert Einstein
Hunter McMillen
Ranch Hand

Joined: Mar 13, 2009
Posts: 492

Sorry everyone I just reread my assignment we dont actually have to create a tree, just need a tree class to hold the root node and are using tabs to indicate tree structure. Sorry for the wasted post.

-Hunter
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Now I'm confused--you indicate that you're going to print out a tree structure (I assume you meant using tabs for indentation) but that you don't need a tree, just a tree class hold the root node?
Hunter McMillen
Ranch Hand

Joined: Mar 13, 2009
Posts: 492

Sorry I didnt explain it fully. All of my node classes inherit from a Node superclass. So all im doing to print out the tree structure is calling all of the node toString() methods and using tabs to indent it.

Ex:
Root
\t Sets:
\t\t digit {0,1,2,3,4,5,6,7,8,9}
\t States:
\t\t initial Q
\t\t final Dead


etc..

-Hunter


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Syntax Tree