This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Syntax Tree" Watch "Syntax Tree" New topic

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.


"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.

David Newton

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.

\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



I agree. Here's the link:
subject: Syntax Tree
Similar Threads
Homework Trouble: Not understood syntax error, Instance of a generic BST class
Dynamic Casting?
Nodes and Elements
Decoupling a Parser Tree from the Object that needs its information
Tree API?