Homegrown java parser ?!?

"bf." <bat_fastard_2000@yahoo.com>
6 Feb 2002 23:40:26 -0500

          From comp.compilers

Related articles
Homegrown java parser ?!? bat_fastard_2000@yahoo.com (bf.) (2002-02-06)
Re: Homegrown java parser ?!? pfroehli@ics.uci.edu (Peter H. Froehlich) (2002-02-16)
Re: Homegrown java parser ?!? clkfa32y4001@sneakemail.com (2002-02-16)
| List of all articles for this month |

From: "bf." <bat_fastard_2000@yahoo.com>
Newsgroups: comp.compilers
Date: 6 Feb 2002 23:40:26 -0500
Organization: BT Openworld
Keywords: Java, parse
Posted-Date: 06 Feb 2002 23:40:26 EST

Hello folks.


I'm currently involved with a project that involves analysis of Java
source code. To achieve this, we have decided that we need to parse
each source file and load it into a tree representing its progmatic
structure. We can then make better comparisons between files.


So far, we have written a tokeniser that breaks a source file down by
seperating its components. This scans a file looking for certain characters
which mark tokens, and then creates an array. ([public] [class] [x] [{]
[public] [method] [(] [int] [name] [,] [int] [name] [)] ... )


We have written a basic language node, and extended it to some basic
language constructs such as import, class, method, declaration. Of course
as the system grows, more of these will be created.


Our problem is how to proceed. How do we convert a series of tokens into a
tree of language nodes ?


[public] [static] [class] [x] [{] ..... [}]
becomes Node_Class (name=x, public=yes, static=yes)


and of course this node will need a pointer to child nodes of the class.


We are not writing a compiler, so we don't need to verify syntax. But
otherwise
I think (?) we're doing similar things to a compiler.


I am new to this area and would really appreciate some
pointers on how to continue.


Many thanks.
bf.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.