Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Tools / May 2004

Tip: Looking for answers? Try searching our database.

[JAVACC]  problem with creating a tree with jjtree

Thread view: 
Markus Schneider - 02 May 2004 09:21 GMT
Hi,

I'm having a little trouble with JavaCC, a parser generator, and its
tree-creating tool jjtree.

I am trying to create a parser (and engine) for a language similar to SQL
and  the first step is to get a parse tree. I have made some tests with
jjtree, but I have a problem. Getting the abstract syntax is already working
fine. For instance the output of a test statement with the dump()-method in
SimpleNode is:

Query
SelectClause
 SelectList
  Identifier
FromClause
 TableReference
  Identifier

But is there a way to also get the information about the actual toke itself?
For example the name (value) of the Identifier. Or if I have an
"AdditiveExpression()" I need to know if it's "+" or "-". There must be a
way to store this information in the tree and to read it out later, when you
execute the commands?

Thanks for helping me.

Markus
Roedy Green - 02 May 2004 13:48 GMT
>I'm having a little trouble with JavaCC, a parser generator, and its
>tree-creating tool jjtree.

I needed a crude parser for Java and had a look at a Java 1.5 Parser.
It is enormous.  I decided to write my own state machine.  It will
probably be only a few pages of code, with a tiny class for each
state.  I am about 90% there.

All I am trying to do is classify tokens for colourising in a Java
code display. I don't need full tree. Just thinking you may have
similar modest interest.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.