refactored interpreter to a private class in parser.java