Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Syntax Tree

 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser Linux VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Hunter McMillen
Ranch Hand
Posts: 492
Firefox Browser Linux VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 492
Firefox Browser Linux VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic