Don't store tree's hidden children in a separate array

Just mark hidden trees as such, and skip them when
pretty-printing a tree
This commit is contained in:
Max Brunsfeld 2014-07-16 18:38:06 -07:00
parent 95fbdb6fdb
commit 779bf0d745
17 changed files with 167 additions and 243 deletions

View file

@ -10,6 +10,6 @@ recovers from errors inside parenthesized expressions
=====================================================
x + (y * + z) * 5
---
(expression (sum
(sum
(variable)
(product (group (ERROR '+')) (number))))
(product (group (ERROR '+')) (number)))

View file

@ -3,51 +3,47 @@ parses numbers
===================
5
---
(expression (number))
(number)
===================
parses variables
===================
x
---
(expression (variable))
(variable)
===================
parses products
===================
x * x
---
(expression (product
(variable)
(variable)))
(product (variable) (variable))
===================
parses sums
===================
x + x
---
(expression (sum
(variable)
(variable)))
(sum (variable) (variable))
===============================================
binds multiplication more tightly than addition
===============================================
a * b + c * d
---
(expression (sum
(sum
(product (variable) (variable))
(product (variable) (variable))))
(product (variable) (variable)))
============================
parses exponents
============================
x + y * z^(a + b)
---
(expression (sum
(sum
(variable)
(product
(variable)
(exponent
(variable)
(group (sum (variable) (variable)))))))
(group (sum (variable) (variable))))))