Interpreter design pattern

You can see a sample implementation of the interpreter design pattern.it’s possible smilliar to each other definitions for interpreter in internet literature.

  •  interpreter pattern is a design pattern that specifies how to evaluate sentences in a language
  • Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
  • Map a domain to a language, the language to a grammar, and the grammar to a hierarchical object-oriented design

Sample scenarios for this pattern

  • read barcode
  • roman numbers converting numbers   –   (X == 10)
  • Total ASCII values ​​of the characters  – (A == 65)
  • reading result operations with mathematical and logical operators (10*5-3==47)
  • analysis of the encrypted text

Now let’s take a look our sample codes and diagram

ClassDiagram1

Main classes

example of use:

see you blog post

also get clone using VisualStudio 2012 with git source control in the bitbucket repository.You can see repository address and git address in the below

Repository : https://bitbucket.org/yemrekeskin/interpreter.designpattern

Git : https://yemrekeskin@bitbucket.org/yemrekeskin/interpreter.designpattern.git to get clone repository

Leave a Reply

Your email address will not be published. Required fields are marked *