What is the need for Interpreter Pattern in C#?When you
implement interpreter pattern in C#, you are allowed to perform the following
tasks on a language wherein a language includes set of operations that
can be performed in the program:
Define grammar for that language Define interpreter to interpret the statements available in that language o Fetch tokens by parsing the symbols available in the language o Use tokens to decide on appropriate actions. o Execute the decided actions. Advantage of using interpreter pattern is its flexibility. Using interpreter pattern, each of the parsing scenarios will be considered as a different object and the objects will be connected using a parse tree. When there is a necessity to change any of the parsing scenarios, you can easily change it in the parse tree without any consequences and with less coding change. However there are certain consequences in using interpreter pattern. They are: User
interface has to be provided for the User to feed in commands for the
language
|