I am curious to know a few real time examples of interpreter pattern. I am able to find a few repeated examples such as the "regular expression" example. Can anyone direct me towards other examples?
Asked
Active
Viewed 5,844 times
4
-
You mean, besides the ones described in "Design Patterns" [GoF] ? – Óscar López Oct 07 '11 at 23:33
-
Yes other than the ones described in gof.Any scenarios one can think of where the pattern fits well. – Aravindh Oct 07 '11 at 23:47
2 Answers
5
Any mechanism for interpreting formal languages suites this pattern perfectly, it can be anything: from a simple calculator to a C# parser.
A lot of software includes command-line input from the user: so named command - shell. Think of different math packages or AutoCAD command input possibilities, basically kind of input that has to be parsed and has a certain level of complexity. Really a lot of complex systems should possess benefit from some formal rules enforced through formal languages

Yurii Hohan
- 4,021
- 4
- 40
- 54
-
So..Could text to speech applications be considered as a real time implementation of this pattern? – Aravindh Oct 10 '11 at 16:22
-
It depends on the task and used algorithms behind it. If you do text recognition, then yes. Formal grammars is the keyword and if you want to know more read Aho's book on compilers. PS: accepted answer without an upvote is strange) – Yurii Hohan Oct 10 '11 at 17:43
-
I dont have enough reps to vote yet..I am a newbie at stackoverflow..thanks for your answer.. – Aravindh Oct 10 '11 at 20:23
1
Have you checked the dofactory sample with roman numbers? It looks quite straight-forward to me.
Another perhaps more comprehensive example might be this calculator.

Nano Taboada
- 4,148
- 11
- 61
- 89
-
The java2s example link below the calculator example "to search a contact list" was a good example...thanks – Aravindh Oct 10 '11 at 16:21