Rewrite with binary trees

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Add parentheses support

Signed-off-by: Timothy Gu <timothygu99@gmail.com>