Interpreter Design Pattern
Aliases π: None
Description π: 1 + 2 + 3
is the same as 3 + 3
after evaluating 1 + 2
. It means that the grammar is Operation := Operand Operator Operand
and Operand
can be another Operation
.
We will follow this logic to create the interpreter.
Advantages β
- Useful for a simple language
Disadvantages π«
- Complicated if a language is complex
Notes π
- None