Introduction
concept: given a language, define a representation of its grammar and define an interpreter that uses that representation to interpret sentences in the language.
Application Scenario: language Interpreter (translates the code we can read into an ugly machine code)
Benefits: use complex things in a simple way.
Example
Interpreter
 Package Note.com.interpreter; /**  @author*/Publicclass  interpreter    {  publicvoid  say (String lag) {        if("NH". Equals (lag)) {            System.out.println ("Hello");     }}
The person who called the Interpreter
 PackageNote.com.interpreter; Public classpeople {Privateinterpreter interpreter;  Publicpeople (interpreter interpreter) { This. Interpreter =interpreter; }        /** Simple language input*/     Public voidsay (String lag) {Interpreter.say (lag);//Invoke Interpreter    }     Publicinterpreter Getinterpreter () {returninterpreter; }     Public voidSetinterpreter (Interpreter interpreter) { This. Interpreter =interpreter; }}
Test class
 Package Note.com.interpreter;  Public class interpretertest {    publicstaticvoid  main (string[] args) {         New interpreter ();         New people (i);        People.say ("NH");}    }
Results
How are you doing
(20) Interpreter mode-code implementation