Design patterns implementation examples

Interpreter

Definition:

Defines a grammatical representation of a language and provides an interpreter to deal with this grammar.


Example:

For example we prepare a program which translates English to Polish. Firstly, we define grammar in a program for instance which phrases have its equivalents in Polish. What are the rules of proper sentence building etc.


C++ code:

/src/interpreter.cpp
Download source code

Interpreter UML class diagram:
Interpreter UML class diagram

Interpreter UML sequence diagram:
Interpreter UML sequence diagram