An interpreter executes a given program. An interpreter can traverse the statements of the program, evaluate the expressions in the current state and update the values of the state in the presence of assignment statements. Interpreter is strongly related to a compiler, the difference being that the compiler first translates the code into the target language, which can then be executed, whereas interpreter directly executes the language. Therefore, both the compiler and interpreter need to do syntactic analysis of the source code.