Search code examples
javaparsingantlrjavacc

What library I can use for parsing words in Java?


I'm trying to discover the type of words fitting they in a lot of categories (date, year, time, names, punctuation, email, etc). I was making my own code to detect this (and worked), but I found libraries like ANTLR and JavaCC.

What I want to do is a taks for these libraries? If yes, what I should use, if not, there is something I can use for this?

What are the recomendations? JavaCC, ANTRL, there is some more? I see that JavaCC generate some classes, but there are things that I don't want it does like tokenization.


Solution

  • Depends on how powerful a parser you need. If you need something very powerful (such as JavaCC or ANTLR) go with them and don't spend too much time trying to make your own.

    If you need something simple, then you can build a simple dictionary lookup parser with little more than regular expressions in Java or maybe even StringTokenizer (if your example is very simplistic).