Description
Given a language, defines a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
Where to use
- SQL Parsers. \n
- Mathematical expression evaluators.
Real World Example
An app that calculates '5 + 10 * 2'. It parses the string into an expression tree and evaluates it.
Code Example
class Interpreter:
def __init__(self):
pass
def execute(self):
print('Executing Interpreter')
