title: Traversing a json abstract syntax tree to build boolean expression
body: <p>After doing hours of research on google and stack overflow, I've come to the conclusion that the following JSON structure properly describes a boolean expression.  I'm not terribly keen on algorithms, but in english (and/or javascript), how would you recursively traverse the tree to rebuild the expression so, in this example, the expression would read:</p>
  
  <p>13 or 14 or (18 and 20 and 19)</p>
  
  <pre><code>var booleanExpression = {
      op   : 'or',
      left : {
          op  : 'or',
          left: {
              op   : 'or',
              left : {
                  op   : 'literal',
                  value: '14'
              },
              right: {
                  op   : 'and',
                  left : {
                      op   : 'and',
                      left : {
                          op   : 'literal',
                          value: '20'
                      },
                      right: {
                          op   : 'literal',
                          value: '19'
                      }
                  },
                  right: {
                      op   : 'literal',
                      value: '18'
                  }
              }
          }
      },
      right: {
          op   : 'literal',
          value: '13'
      }
  };
  </code></pre>