[antlr-interest] parsing single java expressions

Vette98Man vette98dude at yahoo.com
Thu Jun 13 09:28:01 PDT 2002


Hi - I have the need to parse java expressions and expressions only, 
and then perform a set of actions based on the semantics of the 
parsed information. I could write my own StringTokenizer to do this, 
but I'm thinking that antlr may be the right tool for the job. Here 
is an example of my inputs: 
 
    1) foobar(foo, bar);
    2) validate(data) && attempts >= 3 ; 
    3) testValue('Action', 7) &&  testValue('LoggedIn', 7) && isEqual
('AdsPlayed',  0) ; 
 
The inputs are guaranteed to be legal java expressions. Can I use 
antlr to parse these statements, and then give me an API into the 
results? What I want is something like for example 2 above, I would 
expect the API to give me the following information: 
 
=======
This expression is composed of two expressions in the form of 
expression1 AND expression2. Expression1 is a method called validate 
that has an argument called data. Expression2 performs a Boolean 
operation of the variable attempts to the value 3. 
 
Any help is appreciated. 

-- 
Cheers,
Bill 


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list