Design Patterns - Interpreter

Given a language, define a representation for it’s grammar along with an interpreter, which interprets sentences in that language. For example, RegEx.

You can use a class for each grammar rule, and expressions in the language will be built by building an object composed of sentences and rules, each one with an interpret method. Suitable for simple grammars. When using complex grammars, it is better to switch to a proper parser.

Notes References

20210408132546 Computer Science - Design patterns

References