1 00:00:00,470 --> 00:00:06,260 The interpreter pattern is well suited for situations when you want to represent a grandmother like 2 00:00:06,260 --> 00:00:14,390 a new language, musical notations, math equations and so on, oftentimes compilers use this pattern 3 00:00:14,390 --> 00:00:15,800 to interpret source code. 4 00:00:17,030 --> 00:00:23,180 As you can see in this UML diagram, an abstract expression interface or abstract class is at the base 5 00:00:23,180 --> 00:00:23,960 of this pattern. 6 00:00:25,530 --> 00:00:29,490 The terminal in terminal expressions are extending the substraction. 7 00:00:30,940 --> 00:00:37,900 The context contains the expression that will be evaluated using this design pattern, the terminal 8 00:00:37,900 --> 00:00:43,990 expressions are evaluated in their current form, whereas the terminal ones are evaluated again until 9 00:00:43,990 --> 00:00:47,050 the context is broken down into terminal expressions. 10 00:00:48,250 --> 00:00:55,180 Some of the weaknesses of this pattern is a complexity as a grammar can be a very complex resource to 11 00:00:55,180 --> 00:00:56,620 transpose in your code. 12 00:00:57,730 --> 00:01:04,060 Also, this pattern can be difficult to maintain as it requires a class for each rule which can increase 13 00:01:04,060 --> 00:01:05,350 the volume of the code. 14 00:01:06,310 --> 00:01:08,760 Let's see how we can implement this pattern.