Refactor boolean traversal

Apply the visitor pattern to boolean expression traversal.
Refactor compile_boolean.