Gelin Luo
Gelin Luo

Reputation: 14373

Java Expression Evaluate

I am trying to develop a parser to parse simple logical relationship expressions, which includes "(", ")", ">", "<", "," as token. An example might be:

a < (b > c > (x, y, z))

From the above expression, I would deduct that:

  1. a relies on b
  2. b is a precondition of c
  3. x, y and z depend on c independently
  4. there is no relationship between a and c
  5. there is no relationship between a, x, y and z

Is there any tool to support this kind of parsing?

thanks, Green

Upvotes: 1

Views: 575

Answers (2)

weekens
weekens

Reputation: 8292

The most famous tool for such things, I guess, is ANTLR.

Upvotes: 0

aseychell
aseychell

Reputation: 1804

You can try JavaCC .. It is a bit tricky to get used to it but once you get it you can easily build such parsers. You can start by following this tutorial. An eclipse plugin is also available which facilitates its use to generate the required files and so on.

Upvotes: 2

Related Questions