non/spire — pull request #269 by denisrosset (2014-07-02 07:41:11+00:00)
Title: Prototype implementation of expression trees

This implements support for expression trees with user-definable value nodes. These can be used for:

- parsing, simplifying and printing expressions involving Rational and BigDecimal numbers, while keeping the BigDecimal literals untouched (this is my use case, see RealTreeTest),
- parsing and printing univariate or multivariate polynomials,
- more general symbolic expressions.

For now, the right abstractions to use are not clear to me. This code should serve as a basis for discussion.

The Unparser class is stand-alone, and is a type class inspired by Kiama's ParenPrettyPrinter to pretty print expression trees, while inserting only parentheses when required.

License remark: Kiama is under LGLP, while Spire is under MIT. Unparser logic is directly inspired by [Kiama](https://code.google.com/p/kiama/source/browse/library/src/org/kiama/output/ParenPrettyPrinter.scala), but has been rewritten completely. Still, the logic is similar.