Friday, 6 January 2012

I was asked to do this for a job interview:


--------------------------------------------------------------------------------------------------
C# Development Exercise

Write a simple evaluator which will parse and evaluate expressions like the
following:

    (5 + 5) * (3 + 2) - 1

It only needs to support the operators * + - () and unary minus. The
submission should be in C# .

We will be considering:

1) Is it readable and understandable?
2) Could the implementation be extended?
3) What were the design decisions? What are the trade-offs?
--------------------------------------------------------------------------------------------------

I came up with this:


Which when compiled and ran :


It works fine .. Even has some basic syntax checking before evaluating.


No comments:

Post a Comment