def p_comparison(p):
 if (len(p) == 4):
  p[0] = binary_ops[p[2]]((p[1], p[3]))
 elif (len(p) == 3):
  p[0] = unary_ops[p[1]](p[2])
 else:
  p[0] = p[1]

def p_comparison ( p ) : if ( len ( p ) == 4 ) : p [ 0 ] = binary_ops [ p [ 2 ] ] ( ( p [ 1 ] , p [ 3 ] ) ) elif ( len ( p ) == 3 ) : p [ 0 ] = unary_ops [ p [ 1 ] ] ( p [ 2 ] ) else : p [ 0 ] = p [ 1 ]
comparison : comparison plus comparison | comparison minus comparison | comparison mult comparison | comparison div comparison | comparison lt comparison | comparison eq comparison | comparison gt comparison | plus comparison | minus comparison | power .