Basic recursive descent parser in Java