4

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?

Dave Schweisguth
  • 36,475
  • 10
  • 98
  • 121
Aravindh
  • 137
  • 3
  • 13

2 Answers2

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