What is the need for Interpreter Pattern
in C#
(C Sharp)?

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
• Considerable effort for defining and building parsing techniques
• Extensive checking of error occurrences due to grammatical elements that are misplaced or misspelled
• If the grammar associated with the language becomes complex, your code might not be easily maintainable

_______________________________________________________________________

Add to My Yahoo!


FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

Visit .NET Programming Tutorial Homepage

______________________________________________________

Recommended Resource

| What is the need for Bridge Pattern in C#? | What is the need for Builder Pattern in C#? | What is the need for Chain of Responsibility Pattern in C#? | What is the need for Command Pattern in C#? | What is the need for Composite Pattern in C#? | What is the need for Decorator Pattern in C#? | What is the need for Flyweight Pattern in C#? | What is the need for Interpreter Pattern in C#? | What is the need for Iterator Pattern in C#? | What is the need for Mediator Pattern in C#? | What is the need for Memento Pattern in C#? | What is the need for Prototype Pattern in C#? | What is the need for State Pattern in C#? | What is the need for Strategy Pattern in C#? | What is the need for Template Method Pattern in C#? | What is the need for unsafe code in C#? | What is the purpose of assert() in C#? | What is the purpose of AutoResetEvent in .NET? | What is the purpose of Console.ReadLine() in C#? | What is the purpose of machine.config file in .NET? |


| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2017 - All Rights Reserved.