Interpreter: Main Topics What Is An Interpreter. Why Should We Learn About Them
Interpreter: Main Topics What Is An Interpreter. Why Should We Learn About Them
Main Topics
What is an Interpreter.
Why should we learn about them.
Simple Definition
Interpreter:
A medium through which unrecognized
information is changed into a form that
can be recognized.
Why Should we learn about
Interpreters
Makes Your Life Easier
– Amount of work
– Amount of programming
– Adaptability to new situations
Why Should we learn about
Interpreters
Makes Your Life Easier
– Amount of work
objects ( operator = )
– Alternation Expression
Is there an alternate expression that is acceptable
(operator | )
– Repetition Expression
Does this repeat itself (operator * )
More Definitions
– Sequence Expression
Determines if both objects are present (operator &)
Class Diagram
– Diagram p.244
Why Should we learn about
Interpreters
Makes Your Life Easier
– Amount of programming
Participants:
AbstractExpression, TerminalExpression,
NonTerminalExpression, Context, Client. (p.245)
Pros & Cons of Interpreters
ANY GUESSES???
Pros & Cons of Interpreters
It’s easy to change and extend the grammar
Inheritance – existing expressions can be modified,
and new expressions can be defined as variations of
old ones
•Sample code
•SmallTalk can be found on pages 248 – 251
•C++ can be found on pages 251 - 255