From Steve Odendahl Date: Thu, 23 Apr 1998 21:16:57 -0600 > >JTB Questionnaire >----------------- > >1. Please provide a short description of JTB as a recommendation to > someone who has never seen or used it before. JTB defines node types (classes) for each production in a JavaCC grammar, constructs a syntax tree for each input to the grammar, and allows an extender of the Visitor class to perform operations based on the type of the node, for every node in the tree. > >2. How would you classify your use of JTB? What kind of work are you > doing or have you done using JTB? I have implemented a markup language on top of HTML to allow text and form input elements to be tied to objects, and from there to a database. The Visitor extension I implemented for this grammar knows how to produce valid HTML from the inputs and the values of the objects, and how to tie values from a POST to fields of the objects. I plan to use JTB to build StyledDocuments (a Swing class) from HTML (since the HTML parser included with Swing is ... inadequate). > >3. What is your opinion on JTB? Did you find the tool useful? Please > rate it on a scale from 1 to 10 (worst to best). > I give it a very solid 8.7. >4. Have you used other similar tools such as JJTree or ANTLR (specifically, > the tree-building aspect of it)? I looked briefly at JJTree and ANTLR, and decided primarily based on learning curve (I was already familiar with JavaCC) to go with JTB. > >5. If you answered yes to number 4, how would you compare JTB with > these other tools? Again, please rate it from 1 to 10 in comparison and > include anything you have to say, including comments on ease of use, > learning curve, etc. > Learning curve is the only thing I can comment on, and that looks solidly in favor of JTB. >6. Please include below any other comments you have regarding JTB. Feel > free to include any suggestions for improvement. > I would like to have the option to generate a Visitor interface (maybe called IVisitor to avoid name clash) as well as the Visitor class. Also, this might be a bit of a hack, but consider using comments with a special format within JavaCC that would allow JTB to produce assigned names for fields within a production rather than the generic auto-produced ones (f0, f1, f2, etc). This would have advantages from the point of view of a) robustness (I sometimes use the wrong field for something generic like a call to toString (), and the compiler can't catch that). b) readability c) maintainability - I wouldn't have to reorder all my references when I modify a production. If you can think of a better way to markup .jj files than my hack of doing it inside comments, that would be great!