Interpreter Design Pattern

Interpreter Design Pattern

This article describes the Interpreter design pattern. This is a behavioral design pattern, a category of design pattern used by software engineers, when writing computer programs.

Introduction

The Interpreter pattern is a design pattern, used in software engineering, to identify meaning to symbols, words or sentances in a language. Computer languages use interpreters and databases use them to evaluate database queries. each symbol or token represents a class, and the relationship between these classes defines the syntax of the language. The Interpreter uses the syntax and grammar to interpret the language.

It is defined as a behavioral design pattern, because program execution can be affected by what is interpreted.

Benefits

The obvious benefit is a unified language that separate systems can share, or a human interface that performs complex operations based on simple keywords.
The logic that constrains an application is exposed through the language, and provides a testable interface of input parameters.

Examples of the pattern

In it's simplest form, an interpreter can be the processor for a naming convention. For example, knowing how to split a filename into chunks and acting on the file depending on the parts of the filename, like storing into a "Sales" database, or processing the file as an ".xml" file.

Another example would be a function to translate of decimal to hex. It takes in the decimal value, then looks up the literal representation of the value and returns the hex equivalent. To do this, it must know the sequence of characters that represent each value, and how they build up from bits to bytes. These rules are the grammar behind the language.

 

Return to Top


See Also

Link to domain parent articles and related articles in TechNet Wiki.

 

 

Return to Top


Community Resources

These are the external links, including links to Microsoft and TechNet sites that are non-Wiki

 

  • [Please contribute]

 

 

Return to Top


References section

Use this section if you pulled source material and ideas from other sites, blogs, or forums. Make sure you have permission from authors to use their material.

 

 

 

Return to Top


Leave a Comment
  • Please add 5 and 6 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Abhishek.Sur edited Revision 3. Comment: let me know if you dont want these updates. If you dont want me to change, my email id is abhi2434@hotmail.com. I am new to Wiki section and learning how to write cool wiki stuffs. I like this feature though.  

  • XAML guy edited Revision 2. Comment: tweak

  • XAML guy edited Revision 1. Comment: tidied sections

  • XAML guy edited Original. Comment: speling

Page 1 of 1 (4 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • XAML guy edited Original. Comment: speling

  • XAML guy edited Revision 1. Comment: tidied sections

  • XAML guy edited Revision 2. Comment: tweak

  • Abhishek.Sur edited Revision 3. Comment: let me know if you dont want these updates. If you dont want me to change, my email id is abhi2434@hotmail.com. I am new to Wiki section and learning how to write cool wiki stuffs. I like this feature though.  

Page 1 of 1 (4 items)