The compiler and interpreter are simply a piece of softwares which translates higher level languages to lower level languages, but the both works bit differently, the compiler compiles the code and generates a binary file or byte code whereas interpreter reads and executes code lien by line.