deepakjois/hs-logo — Issue #40: Evaluation logic is awkward
Author: deepakjois
Created: 2012-02-25 17:56:19+00:00
State: open

Currently the evaluation logic in `Evaluator.hs` is pretty awkward. This makes implementing control primitives like `for` a bit cumbersome. Here are some of the problems:

* `eval` method works only on binary expressions with `NumLiteral` tokens on both sides
* evaluating a list involves calling a different method called `evaluateList`

Here are some initial ideas to fix this:

* Rename `eval` to `evalBinOp` or something
* Have methods for each type of operation, like `evalWord`, `evalExpr`, `evalList`
* Have a new method called `eval` which does pattern matching to determine what kind of evaluation to perform on a token, and then return a logotoken as a return type.
* Change the control structures to use eval so that they dont have to be concerned about what is passed in