I need to write a compiler. It\'s homework at the univ. The teacher told us that we can use any API we want to do the parsing of the code, as long as it is a good one. That way
If you're going to go hardcore, throw in a bit of http://llvm.org in the mix :)
Have a look at JavaCC, a language parser for Java. It's very easy to use and get the hang of
I suggest you look at at the source for BeanShell. It has a compiler for Java and is fairly simple to read.
Go classic - Lex + Yacc. In Java it spells JAX and javacc. Javacc even has some Java grammars ready for inspection.
http://java-source.net/open-source/parser-generators and http://catalog.compilertools.net/java.html contain catalogs of tools for this. Compare also the Stackoverflow question Alternatives to Regular Expressions.
JFlex is a scanner generator which, according to the manual, is designed to work with the parser generator CUP.
One of the main design goals of JFlex was to make interfacing with the free Java parser generator CUP as easy as possibly [sic].
It also has support for BYACC/J, which, as its name suggests, is a port of Berkeley YACC to generate Java code.
I have used JFlex itself and liked it. Howeveer, the project I was doing was simple enough that I wrote the parser by hand, so I don't know how good either CUP or BYACC/J is.