Java Interpreter mode (Interpreter Mode)
Interpreter definition: defines the grammar of a language and creates an Interpreter to explain sentences in the language. Interpreter seems to be not widely used. It describes how a language Interpreter is made up. In practice, we may seldom construct a language grammar. Let's take a simple look. First, you must create an interface to describe common operations. Public interface extends actexpression {void interpret (Context context);} Then, let's take a look at the specific implementation of public interface Context {} extends actexpression, which contains some global information other than the interpreter: terminator expressions and non-terminator expressions. Public class TerminalExpression implements extends actexpression {public void interpret (Context context) {}} for no rule in grammar, non-terminator expressions are required: public class NonterminalExpression implements limit actexpression {private limit actexpression successor; public void setSuccessor (effecactexpression successor) {this. successor = successor;} public response actexpression getSuccessor () {return successor;} public void interpret (Context context ){}}