A little fun with Java this time. I want to write a program that reads a code from standard input (line by line, for example), like:
// some
Another alternative is to use some library supporting AST parsing, for e.g. org.eclipse.jdt.core has all the APIs you need to do this and more. But then that's just one alternative:)